@@ -17,19 +17,20 @@ jobs:
1717 - name : Check if actor is org member
1818 id : is-org-member
1919 run : |
20- if [ "${{ github.actor }} " = "dependabot[bot]" ]; then
20+ if [ "$ACTOR " = "dependabot[bot]" ]; then
2121 echo "is-org-member-result=false" >> "$GITHUB_OUTPUT"
2222 exit 0
2323 fi
2424 status=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $GH_TOKEN" \
25- https://api.github.com/orgs/PaloAltoNetworks/members/${{ github.actor }} )
25+ " https://api.github.com/orgs/PaloAltoNetworks/members/${ACTOR}" )
2626 if [ "$status" = "204" ]; then
2727 echo "is-org-member-result=true" >> "$GITHUB_OUTPUT"
2828 else
2929 echo "is-org-member-result=false" >> "$GITHUB_OUTPUT"
3030 fi
3131 env :
3232 GH_TOKEN : ${{ secrets.PAT }}
33+ ACTOR : ${{ github.actor }}
3334
3435 analyze :
3536 if : github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' && needs.precheck.outputs.is-org-member-result == 'true'
5051 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
5152 with :
5253 ref : ${{ github.event.pull_request.head.sha }}
54+ persist-credentials : false
5355
5456 - name : Initialize CodeQL
5557 uses : github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
7981 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
8082 with :
8183 ref : ${{ github.event.pull_request.head.sha }}
84+ persist-credentials : false
8285
8386 - name : Initialize CodeQL
8487 uses : github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3
@@ -104,6 +107,7 @@ jobs:
104107 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
105108 with :
106109 ref : ${{ github.event.pull_request.head.sha }}
110+ persist-credentials : false
107111
108112 - name : Setup node
109113 uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v4
@@ -120,6 +124,9 @@ jobs:
120124 - name : Build site
121125 run : yarn build-demo && zip -r build.zip demo/build
122126
127+ - name : Check for tampered config
128+ run : git diff --exit-code -- firebase.json .firebaserc package.json yarn.lock 'demo/docusaurus.config.*' 'scripts/**' '.github/**'
129+
123130 - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
124131 with :
125132 name : build
@@ -130,6 +137,7 @@ jobs:
130137 needs : build
131138 if : ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' && !failure() && !cancelled() }}
132139 runs-on : ubuntu-latest
140+ environment : preview
133141 permissions :
134142 contents : read
135143 pull-requests : write
@@ -141,6 +149,8 @@ jobs:
141149 steps :
142150 - name : Checkout repository
143151 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
152+ with :
153+ persist-credentials : false
144154
145155 - name : Setup node
146156 uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v4
@@ -167,7 +177,7 @@ jobs:
167177 name : build
168178
169179 - name : Unzip build artifact
170- run : unzip build.zip
180+ run : unzip -n build.zip 'demo/build/*'
171181
172182 - name : Deploy to Firebase
173183 id : deploy_preview
@@ -195,6 +205,7 @@ jobs:
195205 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
196206 with :
197207 ref : ${{ github.event.pull_request.head.sha }}
208+ persist-credentials : false
198209
199210 - name : Setup node
200211 uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v4
@@ -215,15 +226,15 @@ jobs:
215226 echo "hash=$hash" >> "$GITHUB_OUTPUT"
216227
217228 - name : Restore cached production screenshots
218- uses : actions/cache@ v5.0.4
229+ uses : actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
219230 with :
220231 path : visual_diffs/prod
221232 key : prod-screenshots-${{ steps.sitemap-hash.outputs.hash }}
222- restore-keys : |
223- prod-screenshots-
224233
225234 - name : Run visual diff
226- run : yarn ts-node scripts/sitemap-visual-diff.ts --preview-url ${{ needs.deploy.outputs.preview_url }} --summary-file visual_diffs/results.json --concurrency 4 --paths "/tests/"
235+ run : yarn ts-node scripts/sitemap-visual-diff.ts --preview-url "$PREVIEW_URL" --summary-file visual_diffs/results.json --concurrency 4 --paths "/tests/"
236+ env :
237+ PREVIEW_URL : ${{ needs.deploy.outputs.preview_url }}
227238
228239 - name : Generate report and summary
229240 run : yarn ts-node scripts/generate-visual-diff-report.ts visual_diffs/results.json visual_diffs/index.html
0 commit comments