Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #16 from gha-trigger/docs/update-readme-2
Browse files Browse the repository at this point in the history
docs: update README
  • Loading branch information
suzuki-shunsuke authored Sep 19, 2022
2 parents 17eda91 + 1a6f5e4 commit cf8db31
Showing 1 changed file with 2 additions and 53 deletions.
55 changes: 2 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,60 +57,9 @@ jobs:

Environment Variables are set by [gha-trigger/set-env-action](https://github.com/gha-trigger/set-env-action).

## Update a commit status per workflow

start-action is run per job, so commit statuses are updated per job by default.
To update commit statuses, start-action calls GitHub API so it may cause GitHub API rate limiting.
If you'd like to decrease API call, you can update commit statuses per not job but workflow.
To do so, please do the following things.

- Set the environment variable `GHA_WORKFLOW_COMMIT_STATUS` to `true` in workflow scope
- Set the parameter `start_workflow` to `true` at only one `start-action`
- Remove `end-action` from all jobs except for the last job
- Add a job to update a commit status at the end of workflow

e.g.

```yaml
env:
GHA_WORKFLOW_COMMIT_STATUS: "true"
jobs:
foo:
steps:
- uses: gha-trigger/start-action@main
id: start
with:
# ...
# commit status is changed to "pending"
update_commit_status: true # set this parameter at only this step
# ...
bar:
steps:
- uses: gha-trigger/start-action@main
id: start
with:
# ...
# Don't set the parameter `update_commit_status`
# commit status isn't changed
# ...
status-check:
runs-on: ubuntu-latest
needs: [foo, bar] # Run this job lastly
if: always()
steps:
- uses: gha-trigger/start-action@main
id: start
with:
# ...
# Don't set the parameter `update_commit_status`
# commit status isn't changed
- uses: gha-trigger/end-action@main
if: always()
with:
github_token: ${{steps.start.outputs.github_app_token}}
state: ${{job.status}}
```
## Update commit statuses per workflow

Please see [Update commit statuses per workflow](https://gha-trigger.github.io/github-actions/#update-commit-statuses-per-workflow).

## LICENSE

Expand Down

0 comments on commit cf8db31

Please sign in to comment.