Replace head_ref with branch name example

This commit is contained in:
Stefan Zweifel 2020-05-10 13:09:18 +02:00
parent a69eabaead
commit 3c687aa8ba

View File

@ -19,7 +19,7 @@ Add the following step at the end of your job, after other steps that might add
commit_message: Apply automatic changes commit_message: Apply automatic changes
# Optional branch to push to, defaults to the current branch # Optional branch to push to, defaults to the current branch
branch: ${{ github.head_ref }} branch: feature-123
# Optional git params # Optional git params
commit_options: '--no-verify --signoff' commit_options: '--no-verify --signoff'
@ -42,8 +42,7 @@ Add the following step at the end of your job, after other steps that might add
## Example ## Example
In this example, we're running `php-cs-fixer` in a PHP project to fix the codestyle automatically, In this example, we're running `php-cs-fixer` in a PHP project to fix the codestyle automatically, then commit possible changed files back to the repository.
then commit possible changed files back to the repository.
Note that we explicitly specify `${{ github.head_ref }}` in the checkout Action. Note that we explicitly specify `${{ github.head_ref }}` in the checkout Action.
This is required in order to work with the `pull_request` event (or any other non-`push` event). This is required in order to work with the `pull_request` event (or any other non-`push` event).
@ -87,6 +86,8 @@ In non-`push` events, such as `pull_request`, make sure to specify the `ref` to
ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
``` ```
You have to do this do avoid that the `checkout`-Action clones your repository in a detached state.
### Commits of this Action do not trigger new Workflow runs ### Commits of this Action do not trigger new Workflow runs
The resulting commit **will not trigger** another GitHub Actions Workflow run. The resulting commit **will not trigger** another GitHub Actions Workflow run.