GitHub Actions to update commit status according to job results
jobs:
foo:
runs-on: ubuntu-latest
steps:
# Start pending
- uses: gha-trigger/commit-status-action@main
with:
github_token: ${{secrets.PERSONAL_GITHUB_TOKEN}}
- run: sleep 20
- run: exit 1
- uses: gha-trigger/commit-status-action@main
if: always()
with:
state: ${{job.status}}
env:
GITHUB_TOKEN: ${{secrets.PERSONAL_GITHUB_TOKEN}}| name | description |
|---|---|
github_token ($GITHUB_TOKEN) |
GitHub Access Token |
- repo_owner (
$GHA_REPOSITORY_OWNER): Repository Owner - repo_name (
$GHA_REPOSITORY_NAME): Repository Name - sha (
$GHA_COMMIT_STATUS_SHA): Updated commit hash - state (
pending): The state of the status. Can be one of:error,failure,pending,success,cancelled - context (
${{ github.workflow }} / ${{ github.job }} (${{ github.event_name }})or${{ github.workflow }} (${{ github.event_name }})) - target_url (
${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}): Target URL - needs: needs context
- start_workflow (boolean): Set true if you update the commit status per workflow and you want to update the commit status in this step. You should set true in only one step
GHA_WORKFLOW_COMMIT_STATUS:trueorfalse. Iftrue, the commit status is updated per workflow, otherwise the commit status is updated per job
Nothing.