Skip to content

Commit

Permalink
pr_labeler: re-architect triager script
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gotmax23 committed Sep 13, 2024
1 parent b09a200 commit 9ba2bf1
Show file tree
Hide file tree
Showing 22 changed files with 642 additions and 415 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,26 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Setup venv
run: |
python -m venv venv
./venv/bin/pip install -r hacking/pr_labeler/requirements.txt
uv venv venv
uv pip install --python venv \
-e hacking/pr_labeler -c tests/pr_labeler.txt
- name: "Run the issue labeler"
if: "github.event.issue || inputs.type == 'issue'"
env:
event_json: "${{ toJSON(github.event) }}"
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
number: "${{ github.event.issue.number || inputs.number }}"
run: |
./venv/bin/python hacking/pr_labeler/label.py issue "${number}"
./venv/bin/ad-triage issue "${number}"
- name: "Run the PR labeler"
if: "github.event.pull_request || inputs.type == 'pr'"
env:
event_json: "${{ toJSON(github.event) }}"
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
number: "${{ github.event.number || inputs.number }}"
run: |
./venv/bin/python hacking/pr_labeler/label.py pr "${number}"
./venv/bin/ad-triage pr "${number}"
1 change: 1 addition & 0 deletions hacking/pr_labeler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.egg-info/
Loading

0 comments on commit 9ba2bf1

Please sign in to comment.