From 88cbb8959efe4677856ca42ea3f7b9800d224131 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 23 Jun 2026 01:37:35 +0000 Subject: [PATCH] chore: migrate to the reusable leanprover-community/intentions workflow Replace the copied 01-claim-issue..04-withdraw-pr workflows with one caller of the maintained reusable workflow. Command vocabulary and the board are unchanged; default-ttl: none preserves "claims never expire", so no board changes are needed. Reuses the existing PAT_TOKEN for the Projects board only; issue assignment and comments use the workflow GITHUB_TOKEN. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/01-claim-issue.yml | 201 ------------------------ .github/workflows/02-disclaim-issue.yml | 166 ------------------- .github/workflows/03-propose-pr.yml | 184 ---------------------- .github/workflows/04-withdraw-pr.yml | 187 ---------------------- .github/workflows/intentions.yml | 15 ++ 5 files changed, 15 insertions(+), 738 deletions(-) delete mode 100644 .github/workflows/01-claim-issue.yml delete mode 100644 .github/workflows/02-disclaim-issue.yml delete mode 100644 .github/workflows/03-propose-pr.yml delete mode 100644 .github/workflows/04-withdraw-pr.yml create mode 100644 .github/workflows/intentions.yml diff --git a/.github/workflows/01-claim-issue.yml b/.github/workflows/01-claim-issue.yml deleted file mode 100644 index 436f0e7..0000000 --- a/.github/workflows/01-claim-issue.yml +++ /dev/null @@ -1,201 +0,0 @@ -name: Claim Issue - -on: - issue_comment: - types: [created] - -jobs: - claim_issue: - if: github.event.issue.pull_request == null && contains(github.event.comment.body, 'claim') && !contains(github.event.comment.body, 'disclaim') - runs-on: ubuntu-latest - - steps: - - name: Check if comment contains only 'claim' (ignoring white spaces, newlines, and case) - id: check_claim - env: - COMMENT: ${{ github.event.comment.body }} - run: | - TRIMMED_COMMENT=$(echo "$COMMENT" | tr -d '\n' | xargs | tr '[:upper:]' '[:lower:]') - if [ "$TRIMMED_COMMENT" != "claim" ]; then - echo "Comment does not contain only 'claim' modulo white spaces, newlines, and case." - exit 1 - fi - echo "Claim comment detected." - - - name: Retrieve project ID - id: get_project_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Check if the issue is classified as 'Unclaimed' - id: check_unclaimed_tasks - run: | - # Retrieve project fields for 'Status' - QUERY=$(cat <> $GITHUB_ENV - - FIELD_QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the "Claimed" option ID - id: find_claimed_tasks_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Move task to "Claimed" column - run: | - echo "Moving task to 'Claimed'..." - echo "ITEM_ID: $ITEM_ID" - echo "FIELD_ID: $FIELD_ID" - echo "CLAIMED_TASKS_ID: $CLAIMED_TASKS_ID" - - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Get issue details - id: issue - run: | - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} > issue.json - cat issue.json - continue-on-error: true - - - name: Check if the commenter is assigned to the issue - id: check_assignee - run: | - COMMENTER="${{ github.event.comment.user.login }}" - ASSIGNED=$(jq --arg user "$COMMENTER" '.assignees[]?.login | select(. == $user)' issue.json) - if [ -z "$ASSIGNED" ]; then - echo "not_assigned=true" >> $GITHUB_ENV - else - echo "not_assigned=false" >> $GITHUB_ENV - fi - - - name: Remove the user from the assignees - if: env.not_assigned == 'false' - run: | - curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -d '{"assignees":["${{ github.event.comment.user.login }}"]}' \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees - - - name: Log the unassignment result - if: env.not_assigned == 'false' - run: echo "User ${{ github.event.comment.user.login }} has been unassigned from the issue." - - - name: Retrieve the project ITEM_ID - id: get_item_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the project FIELD_ID for "Status" - id: get_field_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the "Unclaimed" option ID - id: find_unclaimed_tasks_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Move task to "Unclaimed" column - run: | - QUERY=$(cat <> $GITHUB_ENV - else - echo "The comment does not contain a valid 'propose #PR_NUMBER' format." - exit 1 - fi - - - name: Retrieve project ID - id: get_project_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Get issue details - run: | - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} > issue.json - - - name: Check if the commenter is assigned to the issue - run: | - COMMENTER="${{ github.event.comment.user.login }}" - ASSIGNED=$(jq --arg user "$COMMENTER" '.assignees[]?.login | select(. == $user)' issue.json) - if [ -z "$ASSIGNED" ]; then - echo "not_assigned=true" >> $GITHUB_ENV - else - echo "not_assigned=false" >> $GITHUB_ENV - fi - - - name: Notify the user if they are not assigned - if: env.not_assigned == 'true' - run: | - echo "User ${{ github.event.comment.user.login }} is not assigned to this issue, exiting." - exit 0 - - - name: Link PR to the issue - if: env.not_assigned == 'false' - run: | - PR_NUMBER="${{ env.pr_number }}" - if [ -z "$PR_NUMBER" ]; then - echo "Error: PR number is not set. Exiting." - exit 1 - fi - - # Get the current PR body (ensure newlines are treated properly) - PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} | jq -r '.body') - - # Remove unnecessary carriage returns - PR_BODY_CLEAN=$(echo "$PR_BODY" | sed 's/\r//g') - - # Append the issue closing reference - NEW_PR_BODY=$(echo -e "${PR_BODY_CLEAN}\n\nCloses #${{ github.event.issue.number }}") - - # Prepare the JSON payload (properly escaped for newlines) - PAYLOAD=$(jq -n --arg body "$NEW_PR_BODY" '{body: $body}') - - # Update the PR body with the properly formatted content - curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "$PAYLOAD" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} - - - name: Retrieve the project ITEM_ID - id: get_item_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the project FIELD_ID for "Status" - id: get_field_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the "In Progress" option ID - id: find_in_progress_tasks_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Move task to "In Progress" column - run: | - QUERY=$(cat <> $GITHUB_ENV - else - echo "The comment does not contain a valid 'withdraw #PR_NUMBER' format." - exit 1 - fi - - - name: Retrieve project ID - id: get_project_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Get issue details - id: get_issue - run: | - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} > issue.json - cat issue.json - - - name: Check if the commenter is assigned to the issue - id: check_assignee - run: | - COMMENTER="${{ github.event.comment.user.login }}" - ASSIGNED=$(jq --arg user "$COMMENTER" '.assignees[]?.login | select(. == $user)' issue.json) - if [ -z "$ASSIGNED" ]; then - echo "not_assigned=true" >> $GITHUB_ENV - else - echo "not_assigned=false" >> $GITHUB_ENV - fi - - - name: Notify the user if they are not assigned - if: env.not_assigned == 'true' - run: | - echo "User ${{ github.event.comment.user.login }} is not assigned to this issue, exiting." - exit 0 - - - name: Unlink PR #PR_NUMBER from the issue - if: env.not_assigned == 'false' - run: | - PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${{ env.pr_number }} | jq -r '.body') - - # Remove "Closes #ISSUE_NUMBER" from the PR body - NEW_PR_BODY=$(echo "$PR_BODY" | sed "s/Closes #${{ github.event.issue.number }}//g") - - # Escape quotes and newlines for JSON - ESCAPED_PR_BODY=$(echo "$NEW_PR_BODY" | jq -Rs '.') - - curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -d "{\"body\": $ESCAPED_PR_BODY}" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${{ env.pr_number }} - - - name: Log PR and issue unlink result - if: env.not_assigned == 'false' - run: echo "PR ${{ env.pr_number }} has been successfully unlinked from issue ${{ github.event.issue.number }}." - - - name: Retrieve the project ITEM_ID - if: env.not_assigned == 'false' - id: get_item_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the project FIELD_ID for "Status" - if: env.not_assigned == 'false' - id: get_field_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Retrieve the "Claimed" option ID - if: env.not_assigned == 'false' - id: find_claimed_tasks_id - run: | - QUERY=$(cat <> $GITHUB_ENV - fi - - - name: Move task to "Claimed" status - if: env.not_assigned == 'false' - run: | - QUERY=$(cat <