Skip to content

Commit

Permalink
ci(github): Updates PR label triage & check
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Feb 4, 2024
1 parent 65f1bdd commit b2fee5e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 29 deletions.
49 changes: 34 additions & 15 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
'module: methods':
- torchcam/methods/*
- changed-files:
- any-glob-to-any-file: torchcam/methods/*

'module: metrics':
- torchcam/metrics.py
- changed-files:
- any-glob-to-any-file: torchcam/metrics.py

'module: utils':
- torchcam/utils.py
- changed-files:
- any-glob-to-any-file: torchcam/utils.py

'ext: demo':
- demo/*
- changed-files:
- any-glob-to-any-file: demo/*

'ext: docs':
- docs/*
- changed-files:
- any-glob-to-any-file: docs/*

'ext: scripts':
- scripts/*
- changed-files:
- any-glob-to-any-file: scripts/*

'ext: tests':
- tests/*
- changed-files:
- any-glob-to-any-file: tests/*

'topic: ci':
- .github/*

'topic: documentation':
- notebooks/*
- README.md
- CONTRIBUTING.md
- changed-files:
- any-glob-to-any-file: .github/*

'topic: docs':
- changed-files:
- any-glob-to-any-file:
- notebooks/*
- README.md
- CONTRIBUTING.md
- CODFE_OF_CONDUCT.md
- CITATION.cff
- LICENSE

'topic: build':
- setup.py
- pyproject.toml
- changed-files:
- any-glob-to-any-file:
- setup.py
- pyproject.toml

'topic: style':
- changed-files:
- any-glob-to-any-file: .pre-commit-config.yaml
20 changes: 11 additions & 9 deletions .github/verify_labels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020-2023, François-Guillaume Fernandez.
# Copyright (C) 2020-2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.
Expand All @@ -20,23 +20,25 @@

# Should specify the type of change
PRIMARY_LABELS = {
"type: new feature",
"type: bug",
"type: enhancement",
"type: feat",
"type: fix",
"type: improvement",
"type: misc",
}

# Should specify what has been modified
SECONDARY_LABELS = {
"topic: documentation",
"module: methods",
"module: utils",
"topic: docs",
"topic: build",
"topic: ci",
"topic: style",
"ext: demo",
"ext: docs",
"ext: scripts",
"ext: tests",
"topic: build",
"topic: ci",
"module: methods",
"module: metrics",
"module: utils",
}

GH_ORG = "frgfm"
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ jobs:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install requests
run: pip install requests
- name: Process commit and find merger responsible for labeling
id: commit
run: echo "::set-output name=merger::$(python .github/verify_labels.py ${{ github.event.pull_request.number }})"
- name: Comment PR
uses: actions/github-script@0.3.0
uses: actions/github-script@v7
if: ${{ steps.commit.outputs.merger != '' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit b2fee5e

Please sign in to comment.