Skip to content

Commit

Permalink
wip: safeguards
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Dec 18, 2024
1 parent 872d5fb commit 655f5c6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/update-screenshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ jobs:

- name: Update screenshots
run: |
# NPM packages and the image update scripts could all be modified by
# an attacker to inject code into this step of the workflow. Use
# copies of those files from the main branch as a safeguard. Up to
# now, nothing controlled by the PR author has been executed.
git checkout main -- \
package-lock.json \
package.json \
build/shakaBuildHelpers.py \
build/updateScreenshots.py \
build/imageSimilarity.js
# Install prerequisites.
npm ci
Expand All @@ -104,7 +115,8 @@ jobs:
git config user.name "shaka-bot"
git config user.email "[email protected]"
# Commit the changes. Ignore failure, in case there are no changes.
# Commit the changes to the screenshots only. Ignore failure, in
# case there are no changes.
git add test/test/assets/screenshots/*/*.png || true
git commit -m ':robot: Update all screenshots' || true
Expand All @@ -113,6 +125,8 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
# Update the PR.
# Compute the destination for the push.
PR_API_URL="/repos/${{ github.repository }}/pulls/${{ inputs.pr }}"
REMOTE=$(gh api $PR_API_URL | jq -r .head.repo.html_url)
BRANCH=$(gh api $PR_API_URL | jq -r .head.ref)
Expand Down

0 comments on commit 655f5c6

Please sign in to comment.