55 paths :
66 - ' **/*.metrics.yaml'
77
8+ permissions :
9+ contents : read
10+
811jobs :
912 metrics-analysis :
1013 runs-on : ubuntu-latest
1518
1619 steps :
1720 - name : Checkout code
18- uses : actions/checkout@v6.0.2
21+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1922 with :
2023 fetch-depth : 0 # Need full history for git diff
2124
@@ -24,19 +27,25 @@ jobs:
2427
2528 - name : Run metrics diff analysis
2629 id : metrics-diff
30+ env :
31+ PR_NUMBER : ${{ github.event.number }}
32+ BASE_SHA : ${{ github.sha }}
33+ HEAD_SHA : ${{ github.event.pull_request.head.sha }}
34+ SERVER_URL : ${{ github.server_url }}
35+ REPOSITORY : ${{ github.repository }}
2736 run : |
2837 # Make sure we have the PR head fetched. Note that we only download the code for comparison,
2938 # we do not run any code from the pull request's version
30- git fetch origin pull/${{ github.event.number } }/head
39+ git fetch origin pull/${PR_NUMBER }/head
3140
3241 # Run the analysis. Compare against the base hash of this PR
3342 ./gradlew :yaml-tests:analyzeMetrics \
34- -PmetricsAnalysis.baseRef="${{ github.sha } }" \
35- -PmetricsAnalysis.headRef="${{ github.event.pull_request.head.sha } }" \
36- -PmetricsAnalysis.urlBase="${{ github.server_url }} /${{ github.repository } }/blob" \
37- -PmetricsAnalysis.repositoryRoot="${{ github.workspace } }" \
38- -PmetricsAnalysis.output="${{ github.workspace } }/metrics-analysis-output.txt" \
39- -PmetricsAnalysis.outlierQueries="${{ github.workspace } }/outlier-queries.txt"
43+ -PmetricsAnalysis.baseRef="${BASE_SHA }" \
44+ -PmetricsAnalysis.headRef="${HEAD_SHA }" \
45+ -PmetricsAnalysis.urlBase="${SERVER_URL} /${REPOSITORY }/blob" \
46+ -PmetricsAnalysis.repositoryRoot="${GITHUB_WORKSPACE }" \
47+ -PmetricsAnalysis.output="${GITHUB_WORKSPACE }/metrics-analysis-output.txt" \
48+ -PmetricsAnalysis.outlierQueries="${GITHUB_WORKSPACE }/outlier-queries.txt"
4049
4150 - name : Add Report To Summary
4251 run : cat metrics-analysis-output.txt > $GITHUB_STEP_SUMMARY
5160 fi
5261
5362 - name : Comment on PR
54- uses : actions/github-script@v9.0.0
63+ uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
5564 continue-on-error : true
5665 with :
5766 github-token : ${{ secrets.GITHUB_TOKEN }}
8897 });
8998
9099 - name : Add inline comments for outliers
91- uses : actions/github-script@v9.0.0
100+ uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
92101 if : steps.check-changes.outputs.SIGNIFICANT_CHANGES == 'true'
93102 continue-on-error : true
94103 with :
0 commit comments