Skip to content

Commit e41283d

Browse files
committed
Mock change
1 parent 15a0b07 commit e41283d

3 files changed

Lines changed: 41 additions & 8 deletions

File tree

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
name: "Remind to run update_dependency.sh"
1+
name: Request Lockfile Review
22

33
on:
44
pull_request:
55
branches: ["master"]
66
types: [opened, synchronize, reopened]
77

88
jobs:
9-
review-lockfiles:
9+
# 1. This job runs safely with NO write permissions.
10+
# It is perfectly safe to check out the untrusted fork code here.
11+
scan-lockfiles:
1012
runs-on: ubuntu-latest
11-
permissions:
12-
pull-requests: write
13-
contents: read
14-
13+
outputs:
14+
any_changed: ${{ steps.changed-files.outputs.any_changed }}
15+
pr_number: ${{ github.event.pull_request.number }}
1516
steps:
1617
- name: Checkout repository
1718
uses: actions/checkout@v4
@@ -23,15 +24,46 @@ jobs:
2324
files: |
2425
**/*.lockfile
2526
27+
# Save the results so the privileged job can read them
28+
- name: Save scan results
29+
run: |
30+
mkdir -p ./results
31+
echo "${{ steps.changed-files.outputs.any_changed }}" > ./results/any_changed.txt
32+
echo "${{ github.event.pull_request.number }}" > ./results/pr_number.txt
33+
34+
- name: Upload artifact
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: lockfile-scan-results
38+
path: ./results/
39+
40+
# 2. This job runs sequentially, but ONLY handles the write operation.
41+
# It never checks out the untrusted PR code, making it completely secure.
42+
comment-lockfiles:
43+
needs: scan-lockfiles
44+
# Only run if the previous scan detected a lockfile change
45+
if: needs.scan-lockfiles.outputs.any_changed == 'true'
46+
runs-on: ubuntu-latest
47+
permissions:
48+
pull-requests: write
49+
steps:
50+
- name: Download artifact
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: lockfile-scan-results
54+
path: ./results
55+
2656
- name: Post unresolved review comment
27-
if: steps.changed-files.outputs.any_changed == 'true'
2857
uses: actions/github-script@v7
2958
with:
3059
script: |
60+
const fs = require('fs');
61+
const prNumber = fs.readFileSync('./results/pr_number.txt', 'utf8').trim();
62+
3163
github.rest.pulls.createReview({
3264
owner: context.repo.owner,
3365
repo: context.repo.repo,
34-
pull_number: context.payload.pull_request.number,
66+
pull_number: parseInt(prNumber, 10),
3567
event: 'COMMENT',
3668
body: `### ⚠️ Attention Required: Lockfile Detected\nThis pull request contains modifications to one or more \`*.lockfile\` files. Please confirm that you have run update_dependency.sh to push new dependencies to the private repo.\n\n_The PR author must manually mark this conversation as resolved before merging._`
3769
})

.github/workflows/update-dependency-reminder.ymlname:

Whitespace-only changes.

gradle.lockfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This is a Gradle generated file for dependency locking.
22
# Manual edits can break the build and are not advised.
33
# This file is expected to be part of source control.
4+
#
45
com.google.code.findbugs:jsr305:3.0.2=checkstyle
56
com.google.errorprone:error_prone_annotations:2.36.0=checkstyle
67
com.google.guava:failureaccess:1.0.3=checkstyle

0 commit comments

Comments
 (0)