Skip to content

Commit

Permalink
ci(github): fix conditionals in matrix of asset-exchange-besu-local
Browse files Browse the repository at this point in the history
The file affected is this one:
`.github/workflows/test_weaver-asset-exchange-besu.yaml`

The if conditions have to be implemented in a different syntax for jobs
that use the `matrix` feature of GitHub Action workflows so a slight
refactor has been done to make the code do what we originally wanted it to.

The fix was heavily inspired by this excellent answer on StackOverflow:
https://stackoverflow.com/a/73822998

```yaml
strategy:
  matrix:
    fruits:
      - apple
      - banana
    exclude:
      - fruits: ${{ github.ref == 'refs/heads/main' && 'dummy' || 'apple' }}
```

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Jan 17, 2024
1 parent 7a7b485 commit 11cbcb6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/test_weaver-asset-exchange-besu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,15 @@ jobs:

asset-exchange-besu-local:
needs: check_code_changed
if: needs.check_code_changed.outputs.status == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
app_contract: ["AliceERC1155", "AliceERC20", "AliceERC721"]
exclude:
- app_contract: ${{ needs.check_code_changed.outputs.status != 'true' }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down

0 comments on commit 11cbcb6

Please sign in to comment.