1
1
name : Modified Target Validation
2
2
3
3
on :
4
- pull_request :
4
+ pull_request_target :
5
5
branches :
6
6
- master
7
7
paths :
@@ -11,13 +11,14 @@ jobs:
11
11
validate-modified-targets :
12
12
runs-on : ubuntu-latest
13
13
permissions :
14
- issues : write
14
+ contents : read
15
+ pull-requests : write
15
16
steps :
16
17
- name : Checkout repository
17
18
uses : actions/checkout@v5
18
19
with :
19
- ref : ${{ github.event.pull_request.head.sha }}
20
- fetch-depth : 0
20
+ ref : ${{ github.base_ref }}
21
+ fetch-depth : 1
21
22
22
23
- name : Set up Python
23
24
uses : actions/setup-python@v6
@@ -33,16 +34,16 @@ jobs:
33
34
run : |
34
35
poetry install --no-interaction --with dev
35
36
36
- - name : Discover modified targets
37
- id : discover-modified
37
+ - name : Drop in place updated manifest from base
38
38
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
44
42
cp sherlock_project/resources/data.json data.json.head
45
43
44
+ - name : Discover modified targets
45
+ id : discover-modified
46
+ run : |
46
47
CHANGED=$(
47
48
python - <<'EOF'
48
49
import json
@@ -66,30 +67,27 @@ jobs:
66
67
if : steps.discover-modified.outputs.changed_targets != ''
67
68
continue-on-error : true
68
69
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
72
73
73
74
- name : Prepare validation summary
74
75
if : steps.discover-modified.outputs.changed_targets != ''
75
76
id : prepare-summary
76
77
run : |
77
- $(poetry env activate)
78
78
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"
80
80
)
81
- deactivate
82
81
echo "$summary" > validation_summary.md
83
82
84
83
- name : Announce validation results
85
84
if : steps.discover-modified.outputs.changed_targets != ''
86
85
uses : actions/github-script@v8
87
86
with :
88
- github-token : ${{ secrets.GITHUB_TOKEN }}
89
87
script : |
90
88
const fs = require('fs');
91
89
const body = fs.readFileSync('validation_summary.md', 'utf8');
92
- github.rest.issues.createComment({
90
+ await github.rest.issues.createComment({
93
91
issue_number: context.payload.pull_request.number,
94
92
owner: context.repo.owner,
95
93
repo: context.repo.repo,
0 commit comments