Skip to content

Commit b406903

Browse files
Merge branch 'devopsdays:main' into main
2 parents 57d2f53 + a373b32 commit b406903

1,131 files changed

Lines changed: 10917 additions & 1303 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Block sponsor asset changes
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
guard:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Detect changes under static/img/sponsors
17+
id: changes
18+
uses: dorny/paths-filter@v3
19+
with:
20+
token: ${{ github.token }}
21+
list-files: json
22+
filters: |
23+
sponsors:
24+
- 'static/img/sponsors/**'
25+
26+
- name: Comment and fail if sponsors directory changed
27+
if: steps.changes.outputs.sponsors == 'true'
28+
uses: actions/github-script@v7
29+
env:
30+
SPONSORS_FILES_JSON: ${{ steps.changes.outputs.sponsors_files }}
31+
with:
32+
script: |
33+
const owner = context.repo.owner;
34+
const repo = context.repo.repo;
35+
const issue_number = context.payload.pull_request.number;
36+
37+
const marker = "<!-- sponsors-dir-guard -->";
38+
39+
let files = [];
40+
try {
41+
files = JSON.parse(process.env.SPONSORS_FILES_JSON || "[]");
42+
} catch (e) {
43+
files = [];
44+
}
45+
46+
const fileList = files.length
47+
? files.map(f => `- \`${f}\``).join("\n")
48+
: "- _(Unable to enumerate files, but changes were detected)_";
49+
50+
const comments = await github.paginate(github.rest.issues.listComments, {
51+
owner,
52+
repo,
53+
issue_number,
54+
per_page: 100,
55+
});
56+
57+
const alreadyCommented = comments.some(c => (c.body || "").includes(marker));
58+
59+
if (!alreadyCommented) {
60+
const body = [
61+
"🚫 **Blocked: sponsor assets directory change detected**",
62+
"",
63+
"This PR adds or modifies files under `static/img/sponsors/`.",
64+
"",
65+
"**These files should not be added or changed.**",
66+
"",
67+
"Please use the `assets/sponsors/*` directory instead.",
68+
"",
69+
"**Affected files:**",
70+
fileList,
71+
"",
72+
marker
73+
].join("\n");
74+
75+
await github.rest.issues.createComment({
76+
owner,
77+
repo,
78+
issue_number,
79+
body,
80+
});
81+
} else {
82+
core.info("Sponsor directory warning comment already exists; skipping comment creation.");
83+
}
84+
85+
core.setFailed("Changes detected under static/img/sponsors/. Revert these changes to pass.");

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
897 KB
177 KB
38.6 KB
623 KB
262 KB
130 KB
435 KB
96.1 KB

0 commit comments

Comments
 (0)