Skip to content

Commit

Permalink
fix(actions): test conditional needs
Browse files Browse the repository at this point in the history
  • Loading branch information
curzolapierre committed Mar 14, 2024
1 parent cbc7baa commit 0305868
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ jobs:
releases:
needs: [linter-master, linter-pull-request, tests]
name: GoReleaser Build on All OS but Windows
if: startsWith(github.ref, 'refs/tags/')
# Usage of needs implies that the job will only run if all the jobs it depends on are successful.
# But in our case, either linter-master or linter-pull-request will be skipped.
# So we need to add a condition to check if the linter-master or linter-pull-request job is successful.
# To do so, we use the `if` condition but we also need to add `always()` to make sure the job is run
# related to https://github.com/actions/runner/issues/2205
# since a success() is added by default and skipped jobs make success to fail we need this workaround
if: always() && startsWith(github.ref, 'refs/tags/') && (needs.linter-master.result == 'success' || needs.linter-pull-request.result == 'success')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -94,7 +100,13 @@ jobs:
releases-windows:
needs: [linter-master, linter-pull-request, tests]
name: GoReleaser Build on Windows
if: startsWith(github.ref, 'refs/tags/')
# Usage of needs implies that the job will only run if all the jobs it depends on are successful.
# But in our case, either linter-master or linter-pull-request will be skipped.
# So we need to add a condition to check if the linter-master or linter-pull-request job is successful.
# To do so, we use the `if` condition but we also need to add `always()` to make sure the job is run
# related to https://github.com/actions/runner/issues/2205
# since a success() is added by default and skipped jobs make success to fail we need this workaround
if: always() && startsWith(github.ref, 'refs/tags/') && (needs.linter-master.result == 'success' || needs.linter-pull-request.result == 'success')
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit 0305868

Please sign in to comment.