Allow dispatching Build Scoped Rector manually#8188
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
workflow_dispatchtrigger tobuild_scoped_rector.yaml, sorector-*package repositories can rebuildrectorphp/rectorright after merging a pull request of their own. Companion pull request inrector-phpunitdoes the dispatching.on: push: branches: - main tags: - '*' + # allows rector-* package repositories to rebuild after their pull request is merged + workflow_dispatch: nullThe rest of the change is what makes a dispatched run behave.
github.event.beforeandgithub.event.afteronly exist in the push event payload, so they are empty on a dispatched run. The git log step is limited to push events:name: "Get Git log" id: git-log + # "before"/"after" exist only in the push event payload + if: github.event_name == 'push'And the commit message uses
github.sha, which is identical togithub.event.afteron push, so push builds keep their current message verbatim:The
git diff --staged --quiet ||guard covers a dispatched build that produces no change at all, e.g. after a test-only pull request in a package repository. Without it,git commitfails withnothing to commitand the build goes red on every such merge.Note on ordering
A dispatch fires the moment a package pull request merges, but the build runs
composer installagainst that package'sdev-main, which Packagist can serve with a few minutes of lag. A dispatched build may therefore rebuild against the previousmain. Not addressed here — a Packagist update hook on the package repositories is the proper fix, and this trigger is still useful without it.