Skip to content

Commit

Permalink
fix: output modified files in changed-files job
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud committed Jun 25, 2024
1 parent 208fb2c commit ce52e79
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ jobs:
- if: steps.cache.outputs.cache-hit != 'true'
run: yarn

get-changed-files:
changed-files:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
modified_files: ${{ steps.changed-files.outputs.modified_files }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
Expand All @@ -47,8 +48,8 @@ jobs:
files: packages/**/*.{sol,json,ts}

compile:
if: ${{ needs.get-changed-files.outputs.any_changed == 'true' }}
needs: [get-changed-files, deps]
if: needs.changed-files.outputs.any_changed == 'true'
needs: [changed-files, deps]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -83,8 +84,8 @@ jobs:

- run: yarn format
tests:
if: ${{ needs.get-changed-files.outputs.any_changed == 'true' }}
needs: [get-changed-files, set-matrix, deps, compile]
if: needs.changed-files.outputs.any_changed == 'true'
needs: [changed-files, set-matrix, deps, compile]
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -104,7 +105,7 @@ jobs:
name: all-artifacts
path: packages/

- if: contains(needs.get-changed-files.outputs.modified_files, matrix.dir)
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir)
name: Test
run: |
workspace=$(jq -r '.name' packages/${{ matrix.dir }}/package.json)
Expand All @@ -117,8 +118,8 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

set-matrix:
if: ${{ needs.get-changed-files.outputs.any_changed == 'true' }}
needs: get-changed-files
if: needs.changed-files.outputs.any_changed == 'true'
needs: changed-files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -131,8 +132,8 @@ jobs:
echo "matrix=$matrix" >> $GITHUB_OUTPUT
slither:
if: ${{ needs.get-changed-files.outputs.any_changed == 'true' }}
needs: [get-changed-files, set-matrix, deps]
if: needs.changed-files.outputs.any_changed == 'true'
needs: [changed-files, set-matrix, deps]
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -156,13 +157,13 @@ jobs:
with:
path: node_modules
key: ${{ needs.deps.outputs.cache-key }}
- if: contains(needs.get-changed-files.outputs.modified_files, matrix.dir)
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir)
name: Compile contracts
run: |
workspace=$(jq -r '.name' packages/${{ matrix.dir }}/package.json)
yarn workspace "$workspace" run compile
- if: contains(needs.get-changed-files.outputs.modified_files, matrix.dir)
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir)
name: Run slither
uses: crytic/[email protected]
id: slither
Expand All @@ -174,7 +175,7 @@ jobs:
slither-args: --filter-paths "test" --exclude-dependencies --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/
target: packages/${{ matrix.dir }}

- if: contains(needs.get-changed-files.outputs.modified_files, matrix.dir)
- if: contains(needs.changed-files.outputs.modified_files, matrix.dir)
name: Upload SARIF files
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down

0 comments on commit ce52e79

Please sign in to comment.