Skip to content

Commit d31b19b

Browse files
authored
Add worflows (#1547)
Signed-off-by: Jael Gu <[email protected]>
1 parent 6ffa050 commit d31b19b

File tree

3 files changed

+125
-7
lines changed

3 files changed

+125
-7
lines changed

.github/pull_request_template.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,47 @@
1-
<!-- If there are many commits but not yours, please re-Fork Bootcamp repo and submit a PR again.-->
1+
## 📌 Description
22

3-
- [ ] A reference to a related issue in your repository.
4-
5-
Each PR is related to an issue, and you need to list that issue.
3+
<!-- Describe what this PR does and why it's needed -->
4+
Closes #[issue_number]
65

7-
- [ ] A description of the changes proposed in the pull request.
6+
## ✅ Changes
87

9-
A brief introduction to this PR.
8+
- [ ] Feature added: ...
9+
- [ ] Bug fixed: ...
10+
- [ ] Refactor: ...
11+
- [ ] Other (explain): ...
1012

11-
- [ ] Add delight to the experience when all tasks are complete :tada:
13+
## 🔬 How to Test
14+
15+
<!-- Provide steps to manually test or describe how it was tested -->
16+
1. ...
17+
2. ...
18+
19+
## 📝 Checklist
20+
21+
- [ ] Code compiles and runs
22+
- [ ] Linting passes (Check jupyter notebooks: `pip install "black[jupyter]"` > `black {file_or_directory}`)
23+
- [ ] PR includes relevant docs or comments
24+
- [ ] Rebased on the latest `main` (no merge commits or conflicts)
25+
26+
## 🧼 Commit Hygiene
27+
28+
✔️ Follow best practices:
29+
- Small, focused commits with clear messages
30+
- Group related changes together
31+
- Avoid large monolithic commits
32+
- Use meaningful commit messages (e.g., `fix:`, `feat:`, `refactor:`)
33+
34+
## 👀 Reviewer Notes
35+
36+
<!-- Any context or areas of focus for reviewers -->
37+
- Please focus on ...
38+
- Watch out for ...
39+
40+
---
41+
42+
### 📎 Related Issues, PRs, or Docs
43+
44+
- Related PR: #
45+
- Issue: #
46+
47+
---

.github/workflows/close-stale.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Close Stale Issues and PRs
2+
3+
on:
4+
schedule:
5+
- cron: '0 1 * * *' # Runs daily at 01:00 UTC
6+
7+
permissions:
8+
issues: write
9+
pull-requests: write
10+
11+
jobs:
12+
stale:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/stale@v9
16+
with:
17+
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
# ⏱ Time before marking as stale
20+
days-before-stale: 90
21+
days-before-close: 5
22+
23+
# 🏷 Stale label (added automatically)
24+
stale-issue-label: 'stale'
25+
stale-pr-label: 'stale'
26+
27+
# 💬 Messages for stale warnings
28+
stale-issue-message: 'This issue has been automatically marked as stale due to 90 days of inactivity. It will be closed in 5 days if no further activity occurs.'
29+
close-issue-message: 'Closing this issue due to prolonged inactivity. Please reopen if needed or add new context.'
30+
31+
stale-pr-message: 'This pull request has been automatically marked as stale due to 90 days of inactivity. It will be closed in 5 days if no further activity occurs.'
32+
close-pr-message: 'Closing this pull request due to prolonged inactivity. Please reopen if needed or add updates.'
33+
34+
# ⚙ Behavior
35+
remove-stale-when-updated: true
36+
exempt-issue-labels: 'keep-open,security'
37+
exempt-pr-labels: 'do-not-close'

.github/workflows/pr_automerge.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# .github/workflows/auto-merge-on-lgtm.yml
2+
name: Auto-Merge on LGTM Label
3+
4+
on:
5+
pull_request:
6+
types: [labeled]
7+
8+
jobs:
9+
auto-merge:
10+
if: github.event.label.name == 'lgtm'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
- name: Check if label was added by a maintainer
18+
uses: actions/github-script@v7
19+
id: check_maintainer
20+
with:
21+
script: |
22+
const labeler = context.payload.sender.login;
23+
const repo = context.repo.repo;
24+
const owner = context.repo.owner;
25+
26+
const { data: collaborators } = await github.rest.repos.listCollaborators({
27+
owner,
28+
repo,
29+
affiliation: 'direct',
30+
});
31+
32+
const isMaintainer = collaborators.some(
33+
(user) => user.login === labeler && ['admin', 'maintain', 'write'].includes(user.permissions.push ? 'write' : 'read')
34+
);
35+
36+
if (!isMaintainer) {
37+
core.setFailed(`Label was added by ${labeler}, who is not a maintainer.`);
38+
}
39+
40+
- name: Enable auto-merge
41+
if: success()
42+
uses: peter-evans/enable-pull-request-automerge@v2
43+
with:
44+
token: ${{ secrets.GITHUB_TOKEN }}
45+
merge-method: rebase # "squash", "merge", or "rebase"

0 commit comments

Comments
 (0)