Skip to content

Commit

Permalink
feat(workflows): improve workflows with actions should-workflow-run
Browse files Browse the repository at this point in the history
… and `wait-for-checks`
  • Loading branch information
dafyddj committed Oct 31, 2024
1 parent ccb67c7 commit 70fe2d1
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions template/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ name: Main
on: [push, pull_request]

jobs:
should-run:
name: Should run
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
should-run: ${{ steps.action.outputs.should-run }}
steps:
- id: action
uses: techneg-it/should-workflow-run@dcbb88600d59ec2842778ef1e2d41f680f876329 # v1.0.0
pre-commit:
name: Run `pre-commit`
needs: should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
env:
# renovate: datasource=custom.python-versions depName=actions/python-versions versioning=pep440
Expand All @@ -17,6 +28,8 @@ jobs:
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
gv:
name: Get value
needs: should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
outputs:
value: ${{ steps.get-value.outputs.value }}
Expand All @@ -29,24 +42,29 @@ jobs:
echo "::notice ::Value: ${{ steps.get-value.outputs.value }}"
show-value:
name: Show value
needs: gv
needs:
- gv
- should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
steps:
- run: |
echo "::notice ::Value: $VALUE"
env:
VALUE: ${{ fromJSON(needs.gv.outputs.value) }}
release:
name: Release
needs:
- pre-commit
- show-value
results:
name: Collect results
permissions:
checks: read
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0
with:
ignore: Collect results
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run `semantic-release`
uses: codfish/semantic-release-action@9a999e0cdb207de2c9d9d4276860435727818989 # v3.4.1
Expand Down

0 comments on commit 70fe2d1

Please sign in to comment.