@@ -16,16 +16,41 @@ jobs:
1616 decide-jobs :
1717 name : Decide which jobs to run
1818 runs-on : ubuntu-latest
19- # We don't run these tests in the merge queue
20- if : github.repository_owner == 'Qiskit' && github.event_name == 'pull_request'
19+ if : github.repository_owner == 'Qiskit'
2120 outputs :
21+ all-changed-files : ${{ steps.changed-files.outputs.ALL_CHANGED_FILES }}
2222 run-notebook-tester : ${{ steps.decide.outputs.RUN_NOTEBOOK_TESTER }}
2323 run-api-checks : ${{ steps.decide.outputs.RUN_API_CHECKS }}
2424 steps :
25+ - uses : actions/checkout@v4
26+ - name : Set up Node.js
27+ uses : actions/setup-node@v4
28+ with :
29+ node-version : 24
30+ - name : Determine all changed files
31+ id : changed-files
32+ env :
33+ GITHUB_TOKEN : ${{ github.token }}
34+ run : |
35+ # GitHub API doesn't give PR information in the merge_group event, but
36+ # we can get the PR number from the branch name
37+ if [[ "${{ github.event_name }}" == 'merge_group' ]]; then
38+ BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
39+ PR_NUMBER="$(echo $BRANCH_NAME | grep -oP '(?<=gh-readonly-queue/main/pr-)\d+')"
40+ else
41+ PR_NUMBER="${{ github.event.number }}"
42+ fi
43+
44+ CHANGED_FILES=$(node scripts/ci/determine-changed-files.ts "${PR_NUMBER}")
45+ {
46+ echo "ALL_CHANGED_FILES<<__GH_OUTPUT__"
47+ printf '%s\n' "$CHANGED_FILES"
48+ echo "__GH_OUTPUT__"
49+ } >> "$GITHUB_OUTPUT"
2550 - name : Decide which jobs to run
2651 id : decide
2752 env :
28- GH_TOKEN : ${{ github.token }}
53+ CHANGED_FILES : ${{ steps.changed-files.outputs.ALL_CHANGED_FILES }}
2954 # If changing these regexes, test them on https://regex101.com/ with the
3055 # following paths (you can paste the block in and uncomment it):
3156 # Add new tests if necessary
@@ -56,13 +81,10 @@ jobs:
5681 # public/learning/image.svg
5782 # .github/workflows/notebook-test-cron.yml
5883 run : |
59- CHANGED_FILES=$(gh pr diff -R Qiskit/documentation ${{ github.event.number }} --name-only)
60- if [ "$(echo "${CHANGED_FILES[@]}" | grep -P $NOTEBOOK_TEST_REGEX || true)" != '' ]
61- then
84+ if [[ "${{ github.event_name }}" == 'pull_request' && -n "$(printf '%s\n' "${CHANGED_FILES}" | grep -P "$NOTEBOOK_TEST_REGEX")" ]]; then
6285 echo "RUN_NOTEBOOK_TESTER=true" >> "$GITHUB_OUTPUT"
6386 fi
64- if [ "$(echo "${CHANGED_FILES[@]}" | grep -P $API_CHECKS_REGEX || true)" != '' ]
65- then
87+ if [[ "${{ github.event_name }}" == 'pull_request' && -n "$(printf '%s\n' "${CHANGED_FILES}" | grep -P "$API_CHECKS_REGEX")" ]]; then
6688 echo "RUN_API_CHECKS=true" >> "$GITHUB_OUTPUT"
6789 fi
6890
7597 - name : Set up Node.js
7698 uses : actions/setup-node@v4
7799 with :
78- node-version : 22
100+ node-version : 24
79101 - name : Install Node.js dependencies
80102 run : npm ci
81103 - name : Install ImageMagick
@@ -110,7 +132,7 @@ jobs:
110132
111133 - name : Get all changed content files
112134 env :
113- GH_TOKEN : ${{ github.token }}
135+ CHANGED_FILES : ${{needs.decide-jobs.outputs.all-changed-files }}
114136 # If changing these regexes, test them on https://regex101.com/ with the
115137 # following paths (you can paste the block in and uncomment it):
116138 # Add new tests if necessary
@@ -126,18 +148,7 @@ jobs:
126148 # scripts/nb-tester/example-notebook.ipynb
127149 id : changed-content-files
128150 run : |
129- # GitHub API doesn't give PR information in the merge_group event, but
130- # we can get the PR number from the branch name
131- if [ "${{ github.event_name }}" == 'merge_group' ]
132- then
133- BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)"
134- PR_NUMBER="$(echo $BRANCH_NAME | grep -oP '(?<=gh-readonly-queue/main/pr-)\d+')"
135- else
136- PR_NUMBER="${{ github.event.number }}"
137- fi
138-
139- CHANGED_FILES=$(gh pr diff -R Qiskit/documentation $PR_NUMBER --name-only)
140- CHANGED_CONTENT_FILES=$(echo "${CHANGED_FILES[@]}" | grep -P $CONTENT_FILE_REGEX || true)
151+ CHANGED_CONTENT_FILES=$(echo "${CHANGED_FILES}" | grep -P $CONTENT_FILE_REGEX || true)
141152 if [ "$CHANGED_CONTENT_FILES" != '' ]
142153 then
143154 echo "ANY_CHANGED=true" >> "$GITHUB_OUTPUT"
@@ -194,13 +205,12 @@ jobs:
194205 runs-on : ubuntu-latest
195206 steps :
196207 - uses : actions/checkout@v4
197-
198208 - name : Get changed files
199209 env :
200- GH_TOKEN : ${{ github.token }}
210+ CHANGED_FILES : ${{needs.decide-jobs.outputs.all-changed-files }}
201211 run : |
202212 mkdir -p .github/outputs
203- gh pr diff -R Qiskit/documentation ${{ github.event.number }} --name-only > .github/outputs/changed-files.txt
213+ echo "${CHANGED_FILES}" > .github/outputs/changed-files.txt
204214
205215 - name : Check if extra linux deps needed
206216 id : check-deps
@@ -265,7 +275,7 @@ jobs:
265275 - name : Set up Node.js
266276 uses : actions/setup-node@v4
267277 with :
268- node-version : 22
278+ node-version : 24
269279 - name : Install Node.js dependencies
270280 run : npm ci
271281 - name : Check internal links
0 commit comments