Skip to content

Commit

Permalink
ci: automatically apply PR labels (immich-app#10064)
Browse files Browse the repository at this point in the history
Motivation
----------
For me as a new contributor it is frustrating to submit a PR and it will always fail. Even worse: I have to wait for another contributor with more power to assign the label for me.

This will improve developer experience, as some of the labels can be assigned automatically based on changed files.

How to test
-----------
1. Merge this PR
2. Submit a couple of PRs with changes in the respective directories
3. Labels should be automatically applied
4. "Enforce PR labels" github workflow will re-run when "Pull Request Labeler" completes
  • Loading branch information
roschaefer authored Jun 9, 2024
1 parent 4d86252 commit 9c33722
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cli:
- changed-files:
- any-glob-to-any-file: cli/**

documentation:
- changed-files:
- any-glob-to-any-file: docs/**

🖥️web:
- changed-files:
- any-glob-to-any-file: web/**

📱mobile:
- changed-files:
- any-glob-to-any-file: mobile/**

🗄️server:
- changed-files:
- any-glob-to-any-file: server/**

🧠machine-learning:
- changed-files:
- any-glob-to-any-file: machine-learning/**
12 changes: 12 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
4 changes: 4 additions & 0 deletions .github/workflows/pr-require-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Enforce PR labels
on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
workflow_run:
workflows: ["Pull Request Labeler"]
types:
- completed
jobs:
enforce-label:
name: Enforce label
Expand Down

0 comments on commit 9c33722

Please sign in to comment.