Skip to content

Commit

Permalink
GH Actions: auto-label new PRs
Browse files Browse the repository at this point in the history
Turns out the PR template does not allow for frontmatter which would set a label on the PRs.

As I'd prefer all new (non-draft) PRs to be marked with `Status: triage`, I went looking for an action which could do this and ended up with an action which can do a lot more.

Again, let's give it a try and see how it goes.

Ref: https://github.com/srvaroa/labeler
  • Loading branch information
jrfnl committed Nov 9, 2023
1 parent 282cca6 commit 6a8d38f
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 4 deletions.
84 changes: 84 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
version: 1
appendOnly: true
labels:
- label: "Status: triage"
draft: False
author-can-merge: False

- label: "Core Component: Config & Ruleset & CLI options"
draft: False
files:
- "src/Config.php$"
- label: "Core Component: Config & Ruleset & CLI options"
draft: False
files:
- "src/Ruleset.php$"
- label: "Core Component: File"
draft: False
files:
- "src/Files/.*"
- label: "Core Component: Fixer"
draft: False
files:
- "src/Fixer.php$"
- label: "Core Component: Reports"
draft: False
files:
- "src/Reports/.*"
- label: "Core Component: Tokenizer"
draft: False
files:
- "src/Tokenizers/.*"
- label: "Core Component: Utils"
draft: False
files:
- "src/Util/.*"

- label: "Focus: Comments/Docblocks"
draft: False
files:
- "src/Standards/.*/Sniffs/Commenting/"
- label: "Focus: Fixer Conflicts"
draft: False
body: ".* fixer conflict.*"

- label: "Standard: Generic"
draft: False
files:
- "src/Standards/Generic/.*"
- label: "Standard: MySource"
draft: False
files:
- "src/Standards/MySource/.*"
- label: "Standard: PEAR"
draft: False
files:
- "src/Standards/PEAR/.*"
- label: "Standard: PSR1"
draft: False
files:
- "src/Standards/PSR1/.*"
- label: "Standard: PSR2"
draft: False
files:
- "src/Standards/PSR2/.*"
- label: "Standard: PSR12"
draft: False
files:
- "src/Standards/PSR12/.*"
- label: "Standard: Squiz"
draft: False
files:
- "src/Standards/Squiz/.*"
- label: "Standard: Zend"
draft: False
files:
- "src/Standards/Zend/.*"

- label: "Type: bug"
draft: False
body: ".* bug .*"
- label: "Type: documentation"
draft: False
files:
- "/Docs/[A-Za-z0-9-]*/.*Standard.xml$"
4 changes: 0 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
labels: ['Status: triage']
---

<!-- Provide a general summary of your changes in the title above. -->

<!--
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/label-new-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Label new PRs

on:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
pull_request_target:
types:
- unlabeled

jobs:
label-new-prs:
runs-on: ubuntu-latest

steps:
- uses: srvaroa/labeler@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 comments on commit 6a8d38f

Please sign in to comment.