11name : Modified Target Validation
22
33on :
4- pull_request :
4+ pull_request_target :
55 branches :
66 - master
77 paths :
@@ -11,13 +11,14 @@ jobs:
1111 validate-modified-targets :
1212 runs-on : ubuntu-latest
1313 permissions :
14- issues : write
14+ contents : read
15+ pull-requests : write
1516 steps :
1617 - name : Checkout repository
1718 uses : actions/checkout@v5
1819 with :
19- ref : ${{ github.event.pull_request.head.sha }}
20- fetch-depth : 0
20+ ref : ${{ github.base_ref }}
21+ fetch-depth : 1
2122
2223 - name : Set up Python
2324 uses : actions/setup-python@v6
@@ -33,16 +34,16 @@ jobs:
3334 run : |
3435 poetry install --no-interaction --with dev
3536
36- - name : Discover modified targets
37- id : discover-modified
37+ - name : Drop in place updated manifest from base
3838 run : |
39- # Fetch the upstream branch
40- git fetch origin ${{ github.base_ref }} --depth=1
41-
42- # Discover changes
43- git show origin/${{ github.base_ref }}:sherlock_project/resources/data.json > data.json.base
39+ cp sherlock_project/resources/data.json data.json.base
40+ git fetch origin pull/${{ github.event.pull_request.number }}/head:pr --depth=1
41+ git show pr:sherlock_project/resources/data.json > sherlock_project/resources/data.json
4442 cp sherlock_project/resources/data.json data.json.head
4543
44+ - name : Discover modified targets
45+ id : discover-modified
46+ run : |
4647 CHANGED=$(
4748 python - <<'EOF'
4849 import json
@@ -66,30 +67,27 @@ jobs:
6667 if : steps.discover-modified.outputs.changed_targets != ''
6768 continue-on-error : true
6869 run : |
69- $( poetry env activate)
70- pytest -q --tb no -rA -m validate_targets -n 20 -- chunked-sites "${{ steps.discover-modified.outputs.changed_targets }}" --junitxml=validation_results.xml
71- deactivate
70+ poetry run pytest -q --tb no -rA -m validate_targets -n 20 \
71+ --chunked-sites "${{ steps.discover-modified.outputs.changed_targets }}" \
72+ --junitxml=validation_results.xml
7273
7374 - name : Prepare validation summary
7475 if : steps.discover-modified.outputs.changed_targets != ''
7576 id : prepare-summary
7677 run : |
77- $(poetry env activate)
7878 summary=$(
79- python devel/summarize_site_validation.py validation_results.xml || echo "Failed to generate summary of test results"
79+ poetry run python devel/summarize_site_validation.py validation_results.xml || echo "Failed to generate summary of test results"
8080 )
81- deactivate
8281 echo "$summary" > validation_summary.md
8382
8483 - name : Announce validation results
8584 if : steps.discover-modified.outputs.changed_targets != ''
8685 uses : actions/github-script@v8
8786 with :
88- github-token : ${{ secrets.GITHUB_TOKEN }}
8987 script : |
9088 const fs = require('fs');
9189 const body = fs.readFileSync('validation_summary.md', 'utf8');
92- github.rest.issues.createComment({
90+ await github.rest.issues.createComment({
9391 issue_number: context.payload.pull_request.number,
9492 owner: context.repo.owner,
9593 repo: context.repo.repo,
0 commit comments