From 5dc18032bde78ae7fb660945b93676661f6c1b43 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 14 Jul 2026 17:44:03 +0200 Subject: [PATCH] Allow dispatching Build Scoped Rector manually Adds a workflow_dispatch trigger, so rector-* package repositories can rebuild rectorphp/rector after merging a pull request of their own. The push event payload fields "before" and "after" are empty on a dispatched run, so the git log step is limited to push events and the commit message uses github.sha, which is identical to github.event.after on push. A dispatched build can also produce no change at all, so the commit is skipped when nothing is staged. --- .github/workflows/build_scoped_rector.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_scoped_rector.yaml b/.github/workflows/build_scoped_rector.yaml index 30b96573a43..06b0e1d1225 100644 --- a/.github/workflows/build_scoped_rector.yaml +++ b/.github/workflows/build_scoped_rector.yaml @@ -8,6 +8,8 @@ on: - main tags: - '*' + # allows rector-* package repositories to rebuild after their pull request is merged + workflow_dispatch: null env: # see https://github.com/composer/composer/issues/9368#issuecomment-718112361 @@ -108,6 +110,8 @@ jobs: - name: "Get Git log" id: git-log + # "before"/"after" exist only in the push event payload + if: github.event_name == 'push' run: | echo "log<> $GITHUB_OUTPUT echo "$(git log ${{ github.event.before }}..${{ github.event.after }} --reverse --pretty='https://github.com/rectorphp/rector-src/commit/%H %s')" >> $GITHUB_OUTPUT @@ -122,7 +126,8 @@ jobs: INPUT_LOG: ${{ steps.git-log.outputs.log }} run: | git add --all - git commit -m "Updated Rector to commit ${{ github.event.after }}" -m "$INPUT_LOG" + # a dispatched build can produce no change at all, e.g. after a test-only pull request + git diff --staged --quiet || git commit -m "Updated Rector to commit ${{ github.sha }}" -m "$INPUT_LOG" git push --quiet origin main # 8.B publish it to remote repository with tag