Skip to content

Commit

Permalink
chore: ci: use composite action for getting workflow conclusion (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarisia committed Nov 18, 2022
1 parent 995ef57 commit b7177aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,12 @@ jobs:
permissions:
actions: read
steps:
- uses: actions/github-script@f05a81df23035049204b043b50c3322045ce7eb3
- uses: sarisia/actions/conclusion@main
id: ghapi
with:
result-encoding: string
script: |
const jobs = await github.paginate(
github.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId
}
)
return jobs.filter(job => job.conclusion !== null && job.conclusion !== "success")
.length > 0 ? 'failure' : 'success'

- uses: sarisia/actions-status-discord@9d12cc6d7c8d55f9cbe5efa643117f8c7423f4cf
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ steps.ghapi.outputs.result }}
status: ${{ steps.ghapi.outputs.conclusion }}
title: ${{ github.workflow }} - conclusion
17 changes: 2 additions & 15 deletions .github/workflows/test-and-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,13 @@ jobs:
permissions:
actions: read
steps:
- uses: actions/github-script@f05a81df23035049204b043b50c3322045ce7eb3
- uses: sarisia/actions/conclusion@main
id: ghapi
with:
result-encoding: string
script: |
const jobs = await github.paginate(
github.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId
}
)
return jobs.filter(job => job.conclusion !== null && job.conclusion !== "success")
.length > 0 ? 'failure' : 'success'

- name: report result
uses: sarisia/actions-status-discord@9d12cc6d7c8d55f9cbe5efa643117f8c7423f4cf
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ steps.ghapi.outputs.result }}
status: ${{ steps.ghapi.outputs.conclusion }}
title: ${{ github.workflow }} - conclusion

0 comments on commit b7177aa

Please sign in to comment.