forked from SiEPIC/openEBL-2025-05
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 3.04 KB
/
PullRequest.yml
File metadata and controls
80 lines (67 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: PullRequest
on:
# pull_request:
# branches:
# - '**'
pull_request_target:
branches:
- '**'
jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
// Get a list of all issues created by the PR opener
// See: https://octokit.github.io/rest.js/#pagination
const creator = context.payload.sender.login
const opts = github.rest.issues.listForRepo.endpoint.merge({
...context.issue,
creator,
state: 'all'
})
const issues = await github.paginate(opts)
const PR_NUMBER = context.payload.pull_request.number;
const REPO_OWNER = context.repo.owner;
const REPO_NAME = context.repo.repo;
// Check if the 'greeted' label is already present
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner: REPO_OWNER,
repo: REPO_NAME,
issue_number: PR_NUMBER,
});
const alreadyGreeted = labels.some(label => label.name === 'greeted');
// Don't post the message more than once.
if (alreadyGreeted) {
console.log(`PR #${PR_NUMBER} has already been greeted.`);
return
}
for (const issue of issues) {
if (issue.number === context.issue.number) {
continue
}
if (issue.pull_request) {
console.log(`Creator #${creator} has already been greeted.`);
return // Creator is already a contributor.
}
}
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `**Welcome**, new contributor!
Thank you for uploading your design.
If you have not already checked it, please run the SiEPIC Functional Verification in KLayout, using the menu SiEPIC-Verification-Functional Layout Check (V).
We are using GitHub Actions to perform several automated checks. Please ensure that there are no failing checks. Each time you update the files in your fork, this pull request will trigger the automated verification. Check back in a few minutes once they are complete. Click on any failing check indiciated with a red "X" to see the detailed errors.
You may continue making updates to your design, or even contributing additonal designs (using a separate file name), until the tape-out deadline.
`
})
// Add the 'greeted' label to mark this PR as greeted
await github.rest.issues.addLabels({
owner: REPO_OWNER,
repo: REPO_NAME,
issue_number: PR_NUMBER,
labels: ['greeted'],
});
console.log(`Welcome message posted for PR #${PR_NUMBER}`);