Skip to content

Commit ad7bfc7

Browse files
Create auto-lock-submissions.yml
1 parent 384832e commit ad7bfc7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Auto-Lock Submissions"
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
8+
jobs:
9+
lock_issue:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Auto-lock ambassador and feedback submissions
13+
uses: actions/github-script@v7
14+
with:
15+
script: |
16+
const issue = await github.rest.issues.get({
17+
owner: context.repo.owner,
18+
repo: context.repo.repo,
19+
issue_number: context.issue.number
20+
});
21+
22+
const labels = issue.data.labels.map(label => label.name);
23+
const shouldLock = labels.includes('ambassador') || labels.includes('feedback');
24+
25+
if (shouldLock) {
26+
// Post the limitation notice before locking
27+
await github.rest.issues.createComment({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
issue_number: context.issue.number,
31+
body: "Please note: This conversation is now locked and limited to **PyTorch Foundation team members** only to maintain the integrity of the submission process."
32+
});
33+
34+
// Lock the issue with 'resolved' reason
35+
await github.rest.issues.lock({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: context.issue.number,
39+
lock_reason: 'resolved'
40+
});
41+
}

0 commit comments

Comments
 (0)