Skip to content

Commit fd3e97c

Browse files
committed
pr_labeler: re-architect triager script
This commit reorganizes the issue/PR triager script and updates the workflow to run more efficiently. - Make the script a proper Python package instead of an unwieldy single file - Use locked dependencies and UV to decrease workflow runtime to under 10 seconds.
1 parent b09a200 commit fd3e97c

22 files changed

+643
-415
lines changed

.github/workflows/labeler.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,26 @@ jobs:
4444
uses: actions/setup-python@v5
4545
with:
4646
python-version: "3.11"
47+
- name: Set up UV
48+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
4749
- name: Setup venv
4850
run: |
49-
python -m venv venv
50-
./venv/bin/pip install -r hacking/pr_labeler/requirements.txt
51+
uv venv venv
52+
uv pip install --python venv \
53+
-e hacking/pr_labeler -c tests/pr_labeler.txt
5154
- name: "Run the issue labeler"
5255
if: "github.event.issue || inputs.type == 'issue'"
5356
env:
5457
event_json: "${{ toJSON(github.event) }}"
5558
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
5659
number: "${{ github.event.issue.number || inputs.number }}"
5760
run: |
58-
./venv/bin/python hacking/pr_labeler/label.py issue "${number}"
61+
./venv/bin/ad-triage issue "${number}"
5962
- name: "Run the PR labeler"
6063
if: "github.event.pull_request || inputs.type == 'pr'"
6164
env:
6265
event_json: "${{ toJSON(github.event) }}"
6366
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
6467
number: "${{ github.event.number || inputs.number }}"
6568
run: |
66-
./venv/bin/python hacking/pr_labeler/label.py pr "${number}"
69+
./venv/bin/ad-triage pr "${number}"

hacking/pr_labeler/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.egg-info/

0 commit comments

Comments
 (0)