diff --git a/.github/workflows/automerge-sync-pr.yml b/.github/workflows/automerge-sync-pr.yml index c9490e2..4b996c2 100644 --- a/.github/workflows/automerge-sync-pr.yml +++ b/.github/workflows/automerge-sync-pr.yml @@ -1,12 +1,12 @@ name: Auto merge changes made to the target branches in a pull request on: - pull_request: - types: - - opened - branches: - - unstable - - experiment + workflow_dispatch: + inputs: + pr_number: + description: Pull request number + required: true + type: string jobs: sync-changes: @@ -14,14 +14,6 @@ jobs: permissions: contents: write pull-requests: write - strategy: - matrix: - include: - - branch: unstable - labels: branch/unstable - - branch: experiment - labels: branch/experiment - fail-fast: false steps: - name: Generate GitHub Auth Token # https://github.com/tibdex/github-app-token @@ -37,12 +29,13 @@ jobs: uses: pascalgn/automerge-action@main env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - MERGE_LABELS: "automerge" - MERGE_REMOVE_LABELS: "automerge" - MERGE_METHOD: "squash" - MERGE_COMMIT_MESSAGE: "ci(github-action): auto merge {pullRequest.number}" - MERGE_FORKS: "false" - MERGE_RETRIES: "0" - MERGE_RETRY_SLEEP: "0" - MERGE_REQUIRED_APPROVALS: "0" + MERGE_LABELS: automerge + MERGE_REMOVE_LABELS: automerge + MERGE_METHOD: squash + MERGE_COMMIT_MESSAGE: "ci(github-action): auto merge ${{ inputs.pr_number }}" + MERGE_FORKS: false + MERGE_RETRIES: 0 + MERGE_RETRY_SLEEP: 0 + MERGE_REQUIRED_APPROVALS: 0 BASE_BRANCHES: "unstable,experiment" + PULL_REQUEST: ${{ inputs.pr_number }} diff --git a/.github/workflows/sync-changes-to-child-branches.yml b/.github/workflows/sync-changes-to-child-branches.yml index 99ffdc5..69827df 100644 --- a/.github/workflows/sync-changes-to-child-branches.yml +++ b/.github/workflows/sync-changes-to-child-branches.yml @@ -26,7 +26,9 @@ jobs: branch/unstable automerge - branch: experiment - labels: branch/experiment + labels: | + branch/experiment + automerge fail-fast: false steps: - name: Generate GitHub Auth Token @@ -54,6 +56,7 @@ jobs: - name: Cherry pick changes into target branch # https://github.com/carloscastrojumo/github-cherry-pick-action uses: carloscastrojumo/github-cherry-pick-action@main + id: cherrypick_pr with: branch: ${{ matrix.branch }} labels: | @@ -65,3 +68,16 @@ jobs: cherry-pick-branch: cherrypick-${{ env.COMMIT_SHORT_SHA }}-${{ matrix.branch }} env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + + - name: Trigger downstream workflow + uses: convictional/trigger-workflow-and-wait@v1.6.5 + with: + owner: ${{ github.repository_owner }} + repo: flake.nix + github_token: ${{ steps.generate_token.outputs.token }} + workflow_file_name: automerge-sync-pr.yml + ref: ${{ github.event.repository.default_branch }} + client_payload: '{"pr_number":"${{ steps.cherrypick_pr.outputs.number }}"}' + trigger_workflow: true + propagate_failure: false + wait_workflow: false