diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 81161f91a9..158c36249f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -112,8 +112,8 @@ jobs: runs-on: ubuntu-latest outputs: # Expose matched filters as job 'packages' output variable - go_package_changes: ${{ steps.filter_go.outputs.changes }} - go_change_count: ${{ steps.length.outputs.GO_CHANGES_LENGTH }} + packages: ${{ steps.filter_go.outputs.changes }} + package_count: ${{ steps.length.outputs.FILTER_LENGTH }} solidity_changes: ${{ steps.filter_solidity.outputs.any_changed }} steps: - uses: actions/checkout@v2 @@ -121,7 +121,7 @@ jobs: fetch-depth: 0 submodules: 'recursive' - # Check if any go files have been changed in each of the go packages + # For pull requests it's not necessary to checkout the code - uses: dorny/paths-filter@v2 name: "Check for Go Changes" id: filter_go @@ -130,31 +130,30 @@ jobs: core: 'core/**' tools: 'tools/**' ethergo: 'ethergo/**' - - # Check for solidity changes, if anything has been changed here we need to regenerate core - name: Check For Solidity Changes id: filter_solidity uses: tj-actions/changed-files@v26.1 with: files: | **/*.sol + - name: Run step if any of the listed files above change + if: steps.filter_solidity.outputs.any_changed == 'true' + run: | + echo "One or more files listed above has changed." - - - id: Get go output changes length + - id: length run: | - # get length of go changes - export GO_CHANGES_LENGTH=$(echo GO_FILTERED_PATHS | jq '. | length') - echo "##[set-output name=GO_CHANGES_LENGTH;]$(echo GO_CHANGES_LENGTH)" + export FILTER_LENGTH=$(echo $FILTERED_PATHS | jq '. | length') + echo "##[set-output name=FILTER_LENGTH;]$(echo $FILTER_LENGTH)" env: - GO_FILTERED_PATHS: ${{ steps.filter_go.outputs.changes }} - + FILTERED_PATHS: ${{ steps.filter_go.outputs.changes }} # make sure the build works build: name: Build needs: changes runs-on: ${{ matrix.platform }} - if: ${{ needs.changes.outputs.go_change_count > 0 }} + if: ${{ needs.changes.outputs.package_count > 0 }} strategy: matrix: go-version: @@ -195,12 +194,12 @@ jobs: name: Lint runs-on: ubuntu-latest needs: changes - if: ${{ needs.changes.outputs.go_change_count > 0 }} + if: ${{ needs.changes.outputs.package_count > 0 }} strategy: matrix: # Parse JSON array containing names of all filters matching any of changed files # e.g. ['package1', 'package2'] if both package folders contains changes - package: ${{ fromJSON(needs.changes.outputs.go_package_changes) }} + package: ${{ fromJSON(needs.changes.outputs.packages) }} steps: - uses: actions/setup-go@v3 with: @@ -325,7 +324,6 @@ jobs: with: files: | *.go - *.json - uses: jwalton/gh-find-current-pr@v1 id: find_pr