chore: merge status sync - #165
Conversation
There was a problem hiding this comment.
Pull request overview
Adds automation to synchronize GitHub Project v2 “Status” for issues referenced by merged PRs, including closing/labeling and milestone assignment, and wires it up to run on PR merge and on manual dispatch.
Changes:
- Added a workflow to run the status sync on
pull_request: closed(merged) and viaworkflow_dispatchwith apr_numberinput. - Added a composite action that detects issue numbers from PR title/body, updates Project v2 Status, and optionally closes/issues-labels/milestones.
- Removed the prior “move closed issue to milestone” workflow.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| .github/workflows/sync-status-on-merge.yml | New workflow entrypoint that generates a GitHub App token and invokes the local composite action on PR merge/manual runs. |
| .github/actions/sync-status-on-merge/action.yml | Composite action implementing issue detection + Project v2 Status transitions + optional close/label/milestone operations. |
| .github/workflows/move-closed-issue-to-milestone.yml | Removes previous milestone automation that ran on issue close events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| jobs: | ||
| sync-status: | ||
| if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true |
| @@ -0,0 +1,37 @@ | |||
| name: "[OpenAEV] Sync Project Status on PR Merge" | |||
| env: | ||
| GH_TOKEN: ${{ inputs.token }} | ||
| OWNER: ${{ github.repository_owner }} | ||
| REPO_NAME: ${{ github.event.repository.name }} | ||
| PR_NUMBER_INPUT: ${{ inputs.pr-number }} | ||
| PR_JSON: ${{ toJson(github.event.pull_request) }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [ -n "$PR_NUMBER_INPUT" ]; then | ||
| PR_JSON=$(gh pr view "$PR_NUMBER_INPUT" --repo "$OWNER/$REPO_NAME" --json title,body) | ||
| fi |
| TITLE_NUMS=$(echo "$TITLE_REF" | grep -oP '\d+') | ||
| fi | ||
|
|
||
| KEYWORD_NUMS=$(echo "$FULLTEXT" | grep -oiP '(close[sd]?|fix(es|ed)?|resolve[sd]?)\s*:?\s*#\d+' | grep -oP '\d+' || true) |
| PROJECT_ID=$(echo "$RESULT" | jq -r '.data.organization.projectV2.id') | ||
| FIELD_ID=$(echo "$RESULT" | jq -r '.data.organization.projectV2.field.id') | ||
| OPTIONS_JSON=$(echo "$RESULT" | jq -c '.data.organization.projectV2.field.options') | ||
|
|
| continue | ||
| fi | ||
|
|
||
| OPTION_ID=$(echo "$OPTIONS_JSON" | jq -r --arg name "$NEW_STATUS" '.[] | select(.name == $name) | .id') |
| if [ "$CLOSE_ISSUE" == "true" ]; then | ||
| gh issue edit "$ISSUE_NUM" --repo "$OWNER/$REPO_NAME" --add-label "solved" | ||
| echo "✅ \"solved\" label added." | ||
| gh issue close "$ISSUE_NUM" --repo "$OWNER/$REPO_NAME" | ||
| echo "✅ Issue closed." | ||
| fi |
| @@ -0,0 +1,214 @@ | |||
| name: 'Sync Project Status on PR Merge' | |||
There was a problem hiding this comment.
todo: seems to be the same as https://github.com/OpenAEV-Platform/openaev/blob/b6ea7676b6859cdc408f8664a6d1ad4d02a62bd4/.github/actions/sync-status-on-merge/action.yml
In this case, this should go here https://github.com/FiligranHQ/filigran-ci-tools/tree/main/actions.
You can ask Guillaume about this.
Proposed changes
Adds a new composite GitHub Action .github/actions/sync-status-on-merge which, when a pull request is merged, updates the status (Project v2 OpenAEV-Platform/openaev#2) of the linked issue depending on whether the feature-flag label is present:
Adds the .github/workflows/openaev-sync-status-on-merge.yml workflow, triggered on pull_request: closed (PR merged) and on workflow_dispatch (manual mode with pr_number).