Skip to content

Commit 92122ea

Browse files
authored
Update workflow to use github.token and pull_request_target
1 parent 78abe49 commit 92122ea

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

.github/workflows/no-sponsors-changes.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Block sponsor asset changes
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, synchronize, reopened, ready_for_review]
66

77
permissions:
@@ -17,15 +17,12 @@ jobs:
1717
id: changes
1818
uses: dorny/paths-filter@v3
1919
with:
20-
token: ${{ secrets.GITHUB_TOKEN }}
20+
token: ${{ github.token }}
2121
list-files: json
2222
filters: |
2323
sponsors:
2424
- 'static/img/sponsors/**'
2525
26-
# This step will:
27-
# 1) Add a single comment (once per PR) listing the files
28-
# 2) Fail the check whenever changes are detected (even if comment already exists)
2926
- name: Comment and fail if sponsors directory changed
3027
if: steps.changes.outputs.sponsors == 'true'
3128
uses: actions/github-script@v7
@@ -39,7 +36,6 @@ jobs:
3936
4037
const marker = "<!-- sponsors-dir-guard -->";
4138
42-
// Parse the changed files list from dorny/paths-filter output
4339
let files = [];
4440
try {
4541
files = JSON.parse(process.env.SPONSORS_FILES_JSON || "[]");
@@ -51,7 +47,6 @@ jobs:
5147
? files.map(f => `- \`${f}\``).join("\n")
5248
: "- _(Unable to enumerate files, but changes were detected)_";
5349
54-
// Check if we already commented
5550
const comments = await github.paginate(github.rest.issues.listComments, {
5651
owner,
5752
repo,
@@ -69,7 +64,7 @@ jobs:
6964
"",
7065
"**These files should not be added or changed.**",
7166
"",
72-
"Please use the `assets/sponsors/*` directory instead."
67+
"Please use the `assets/sponsors/*` directory instead.",
7368
"",
7469
"**Affected files:**",
7570
fileList,
@@ -87,5 +82,4 @@ jobs:
8782
core.info("Sponsor directory warning comment already exists; skipping comment creation.");
8883
}
8984
90-
// Always fail the check if files in this directory were touched
9185
core.setFailed("Changes detected under static/img/sponsors/. Revert these changes to pass.");

0 commit comments

Comments
 (0)