[1.x] Allow to Pass Custom Git Actor to flarum/action-build
#4078
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.
Counterpart to flarum/action-build#14
Fixes #0000
Some organizations might be looking into restricting pushing directly to the default branch and instead want to require that every change must be done on a non-protected branch and only merged via a pull request.
The issue is that
flarum-bot
doesn't qualify as an actor which can be selected to bypass required pull requests (at least for third-party organizations, not sure if it works in theflarum
org itself).This PR and flarum/action-build#14 aims to optionally add the ability for repository maintainers to customize the actor which commits the bundled JS (by default
flarum-bot
) and set up branch protection rules, while still allowing the bundled JS to be automatically committed to the default branch.Changes proposed in this pull request:
This PR introduces two new inputs and a new secret:
git_actor_name
git_actor_email
git_actor_token
Those new values can optionally be used in the frontend workflow of extensions (which use the reusable frontend workflow) like this:
Outline of how it works
Note
This guide is written for usage in private extensions. The required setup for
Advanced version
below might differ for your use case.The changes introduced in this PR can be used in two "levels" depending on what the repository maintainer wants to achieve:
Light Version: If a maintainer is just looking into changing the actor, without setting up branch protection rules as explained in the beginning, only the
git_actor_name
and (ideally) thegit_actor_email
have to be provided in the frontend workflow of your extension. Both values can either be based on a real GitHub user or a fictional, non-existing one. If a real user is used, it's recommended to use the email which GitHub provides for web-based operations when email privacy is enabled (see https://github.com/settings/emails).Advanced version: If a maintainer is looking into setting up branch protection rules and exempting the new custom actor for it, the following steps are a prerequisite for it:
personal access token (classic)
. Select an expiration date and name which makes sense for you and select therepo
(full) andworkflow
scopes.git_actor_name
andgit_actor_email
input. Also add the just created secret, like in the example workflow above.Important
When setting up branch protection rules and requiring a pull request before merging, don't select the
Do not allow bypassing the above settings
option. This will prevent the bundled JS from being committed. Also verify that you don't have other rules, rulesets, roles etc. in place which might interfere with the logic.Reviewers should focus on:
If this PR and flarum/action-build#14 get merged, please update the
flarum/action-build
version in theREUSABLE_FRONTEND
workflow.Screenshot
If maintainers don't provide the values introduced here,
flarum-bot
will be used like before as the actor which commits the bundled JS:If maintainers provide the `git_actor_name` and `git_actor_email` values with a real GitHub user:
If maintainers provide a non-existing user or non-matching values (i.e. an email address which doesn't match with the username:
QA
Necessity
Confirmed
composer test
).Required changes: