11name : Block sponsor asset changes
22
33on :
4- pull_request :
4+ pull_request_target :
55 types : [opened, synchronize, reopened, ready_for_review]
66
77permissions :
@@ -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
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 || "[]");
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,
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,
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