Skip to content

Commit 184d564

Browse files
austinvazquezKern--
authored andcommitted
Add workflow to label pull requests
This change adds a GitHub Actions workflow to label PR's based on their changes. The following labels will be applied to pull requests: - `documentation` - updates to `**/*.md` - `go` - updates to `**/*.go` - `testing` - updates to `**/*_test.go` - `github_actions` - updates to `.github/` - `benchmarking` - updates to `benchmark/` - `dependencies` - updates to `go.(mod|sum)` Signed-off-by: Austin Vazquez <[email protected]>
1 parent e18850c commit 184d564

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/new-pull-request-labels.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
documentation:
2+
- '**/*.md'
3+
4+
github_actions:
5+
- .github/**
6+
- scripts/**
7+
8+
go:
9+
- '**/*.go'
10+
11+
testing:
12+
- integration/**
13+
- '**/*_test.go'
14+
15+
benchmarking:
16+
- benchmark/**
17+
18+
dependencies:
19+
- cmd/go.mod
20+
- cmd.go.sum
21+
- go.mod
22+
- go.sum
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "New Pull Requests"
2+
3+
on:
4+
# It is safe to use pull_request_target here because we are not checking out
5+
# code from the pull request branch.
6+
#
7+
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
8+
pull_request_target:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
label:
15+
if: github.event.pull_request.draft == false
16+
runs-on: ubuntu-20.04
17+
18+
permissions:
19+
pull-requests: write
20+
21+
steps:
22+
# Use label configuration from main instead of from the pull request branch
23+
# to mitigate running untrusted workflows with write permissions.
24+
- uses: actions/labeler@v5
25+
with:
26+
configuration-path: '.github/new-pull-request-labels.yml'
27+
sync-labels: true

0 commit comments

Comments
 (0)