Skip to content

Commit 11ed7f1

Browse files
committed
Add PR labeler actions
1 parent 469ce39 commit 11ed7f1

8 files changed

+232
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Add 'size: small' to any changes below 10 lines
2+
'size: small':
3+
max: 9
4+
5+
# Add 'size: medium' to any changes between 10 and 100 lines
6+
'size: medium':
7+
min: 10
8+
max: 99
9+
10+
# Add 'size: large' to any changes of at least 100 lines
11+
'size: large':
12+
min: 100

.github/label-actions.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Configuration for Label Actions - https://github.com/dessant/label-actions
2+
3+
# Automatically close pull requests when the `status: duplicate` label is applied
4+
'status: duplicate':
5+
prs:
6+
# Post a comment
7+
comment: >
8+
This pull request is a duplicate. Please direct all discussion to the original pull request.
9+
# Close the pull request
10+
close: true
11+
# Remove other status labels
12+
unlabel:
13+
- 'status: accepted'
14+
- 'status: needs clarification'
15+
- 'status: needs r&d'
16+
- 'status: needs revision'
17+
- 'status: pending triage'
18+
- 'status: rejected'
19+
- 'status: resolved'
20+
- 'status: resolved internally'
21+
- 'status: reviewing internally'
22+
- 'status: stale'
23+
24+
'status: stale':
25+
prs:
26+
# Close the pull request
27+
close: true
28+
# Remove other status labels
29+
unlabel:
30+
- 'status: accepted'
31+
- 'status: duplicate'
32+
- 'status: needs clarification'
33+
- 'status: needs r&d'
34+
- 'status: needs revision'
35+
- 'status: pending triage'
36+
- 'status: rejected'
37+
- 'status: resolved'
38+
- 'status: resolved internally'
39+
- 'status: reviewing internally'
40+
41+
'status: rejected':
42+
prs:
43+
# Close the pull request
44+
close: true
45+
# Remove other status labels
46+
unlabel:
47+
- 'status: accepted'
48+
- 'status: duplicate'
49+
- 'status: needs clarification'
50+
- 'status: needs r&d'
51+
- 'status: needs revision'
52+
- 'status: pending triage'
53+
- 'status: resolved'
54+
- 'status: resolved internally'
55+
- 'status: reviewing internally'
56+
- 'status: stale'

.github/labeler.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Add Documentation tag to PR's changing markdown files, or anything in the docs folder
2+
'pr: documentation':
3+
- changed-files:
4+
- any-glob-to-any-file: '**/*.md'
5+
6+
# Add HScript tag to PR's changing hscript files
7+
'pr: hscript':
8+
- changed-files:
9+
- any-glob-to-any-file: '**/*.hxc'
10+
11+
# Add Chart tag to PR's changing chart files
12+
'pr: chart':
13+
- changed-files:
14+
- any-glob-to-any-file: 'preload/data/songs/**'
15+
16+
# Add Audio tag to PR's changing audio files
17+
'pr: audio':
18+
- changed-files:
19+
- any-glob-to-any-file:
20+
- '**/*.mp3'
21+
- '**/*.ogg'
22+
23+
# Add Art tag to PR's changing image or animation files
24+
'pr: art':
25+
- changed-files:
26+
- any-glob-to-any-file:
27+
- 'preload/images/**'
28+
- 'shared/images/**'
29+
- '**/*.png'
30+
31+
# Add GitHub tag to PR's changing yml files, or anything in the .github folder
32+
'pr: github':
33+
- changed-files:
34+
- any-glob-to-any-file:
35+
- '.github/**'
36+
- '**/*.yml'

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Please read the Contributing Guide (https://github.com/FunkinCrew/Funkin/blob/main/docs/CONTRIBUTING.md) before submitting this PR. -->
2+
3+
<!-- Is this PR associated with a PR from the main repo? If so, link it below. -->
4+
## Associated Funkin PR
5+
6+
<!-- Does this PR close any issues? If so, link them below. -->
7+
## Linked Issues
8+
9+
<!-- Briefly describe the issue(s) fixed. -->
10+
## Description
11+
12+
<!-- Include any relevant screenshots or videos. -->
13+
## Screenshots/Videos
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Cancel queued workflows on PR merge
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
10+
cancel_stuff:
11+
if: github.event.pull_request.merged == true
12+
runs-on: build-set
13+
permissions:
14+
actions: write
15+
16+
steps:
17+
- name: Cancel queued workflows for ${{ github.event.pull_request.head.ref }}
18+
uses: actions/github-script@v7
19+
with:
20+
result-encoding: string
21+
retries: 3
22+
script: |
23+
let branch_workflows = await github.rest.actions.listWorkflowRuns({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
workflow_id: "build-shit.yml",
27+
status: "queued",
28+
branch: "${{ github.event.pull_request.head.ref }}"
29+
});
30+
let runs = branch_workflows.data.workflow_runs;
31+
runs.forEach((run) => {
32+
github.rest.actions.cancelWorkflowRun({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
run_id: run.id
36+
});
37+
});
38+
console.log(runs);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Perform actions when labels are applied to issues, discussions, or pull requests
2+
# See .github/label-actions.yml
3+
name: 'Label Actions'
4+
5+
on:
6+
issues:
7+
types:
8+
- labeled
9+
- unlabeled
10+
pull_request_target:
11+
types:
12+
- labeled
13+
- unlabeled
14+
discussion:
15+
types:
16+
- labeled
17+
- unlabeled
18+
19+
permissions:
20+
contents: read
21+
issues: write
22+
pull-requests: write
23+
discussions: write
24+
25+
jobs:
26+
action:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: dessant/label-actions@v4
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Pull Request Labeler 2 (Runs on PR creation)"
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
7+
jobs:
8+
# Apply `status: pending triage` to newly created pull requests
9+
apply-pending-triage:
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Apply "status pending triage" to new pull requests
16+
uses: actions-ecosystem/action-add-labels@v1
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
labels: "status: pending triage"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
- pull_request_target
4+
5+
jobs:
6+
# Apply labels to pull requests based on which files were edited
7+
labeler:
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set basic labels
14+
uses: actions/labeler@v5
15+
with:
16+
sync-labels: true
17+
# Apply labels to pull requests based on how many lines were edited
18+
changed-lines-count-labeler:
19+
permissions:
20+
contents: read
21+
pull-requests: write
22+
runs-on: ubuntu-latest
23+
name: An action for automatically labelling pull requests based on the changed lines count
24+
steps:
25+
- name: Set change count labels
26+
uses: vkirilichev/[email protected]
27+
with:
28+
repo-token: ${{ secrets.GITHUB_TOKEN }}
29+
configuration-path: .github/changed-lines-count-labeler.yml

0 commit comments

Comments
 (0)