Skip to content

Commit ef3c5cc

Browse files
authored
Allow dispatching Build Scoped Rector manually (#8188)
1 parent a4f37d9 commit ef3c5cc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/build_scoped_rector.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
- main
99
tags:
1010
- '*'
11+
# allows rector-* package repositories to rebuild after their pull request is merged
12+
workflow_dispatch: null
1113

1214
env:
1315
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
@@ -108,6 +110,8 @@ jobs:
108110
-
109111
name: "Get Git log"
110112
id: git-log
113+
# "before"/"after" exist only in the push event payload
114+
if: github.event_name == 'push'
111115
run: |
112116
echo "log<<EOF" >> $GITHUB_OUTPUT
113117
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:
122126
INPUT_LOG: ${{ steps.git-log.outputs.log }}
123127
run: |
124128
git add --all
125-
git commit -m "Updated Rector to commit ${{ github.event.after }}" -m "$INPUT_LOG"
129+
# a dispatched build can produce no change at all, e.g. after a test-only pull request
130+
git diff --staged --quiet || git commit -m "Updated Rector to commit ${{ github.sha }}" -m "$INPUT_LOG"
126131
git push --quiet origin main
127132
128133
# 8.B publish it to remote repository with tag

0 commit comments

Comments
 (0)