Skip to content

Finalize Commit Status #183

Finalize Commit Status

Finalize Commit Status #183

name: Finalize Commit Status
on:
workflow_run:
workflows:
["Backend e2e tests", "Frontend e2e tests", "Storybook Tests"]
branches: [main]
types:
- completed
jobs:
finalize-commit-status:
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Check workflows statuses
id: set-is-successful
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { data: workflows } = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: context.sha
});
const isSuccessful = workflows.workflow_runs.every(run => {
const { name, conclusion } = run;
if (name === 'Finalize Commit Status') {
return true
}
return conclusion === 'success';
});
return isSuccessful ? 'success' : 'failure';
- name: Set commit status to success if all the workflows completed successfully.
uses: guibranco/github-status-action-v2@v1.1.13
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
state: ${{ steps.set-is-successful.outputs.result }}
context: Set the commit status
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}