Skip to content

Commit 91ebd25

Browse files
[stable-2.14] Backport pr_labeler changes (#1918)
* pr_labeler: improve create_boilerplate_comment logging (cherry picked from commit 5730ba9) * pr_labeler: add --force-process-closed flag (cherry picked from commit 44ffe0f) * pr_labeler: add warning for porting_guides changes This adds a warning message when PRs are created that edit porting_guides by someone outside of the Release Management WG. These files are automatically generated during the ansible release process and should not be modified. Fixes: #503 (cherry picked from commit d2e6625) * pr_labeler: use @release-management-wg team for porting_guide check Instead of hardcoding the list of release managers, we can use the Github API to retrieve the members of the `@ansible/release-management-wg` team. (cherry picked from commit dddfd7e) * pr_labeler: exempt bots from porting_guide check For example, patchback is not a release manager, but we still want it to backport Porting Guide PRs. (cherry picked from commit 746662c) * pr_labeler: improve porting_guide_changes template wording Co-authored-by: Sandra McCann <[email protected]> (cherry picked from commit 95ece7e) * pr_labeler: refactor new_contributor_welcome code (#990) * pr_labeler: add GlobalArgs.full_repo property * pr_labeler: refactor new_contributor_welcome code As of #69, the pr_labeler responds with a welcome message when an issue or PR is opened by a new contributor. It turns out this never actually worked properly. The previous method that relied on Github's `author_association` flag did not work with the app token that the pr_labeler uses. This refactors the code to figure out whether a user is a new contributor by searching the list of issues and PRs. Fixes: #204 * pr_labeler: address potential race condition (cherry picked from commit 763815d) * Bump actions/setup-python from 4 to 5 (#966) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... (cherry picked from commit 466b1fd) * pr_labeler: re-architect triager script (#1882) 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. (cherry picked from commit 7138e42) (cherry picked from commit 1cf9f79) --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 566dadc commit 91ebd25

22 files changed

+648
-330
lines changed

.github/workflows/labeler.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,29 @@ jobs:
4141
- name: Checkout parent repository
4242
uses: actions/checkout@v4
4343
- name: Install Python 3.11
44-
uses: actions/setup-python@v4
44+
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.egg-info/

hacking/pr_labeler/label.py

Lines changed: 0 additions & 310 deletions
This file was deleted.

hacking/pr_labeler/pr_labeler/__init__.py

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (C) 2023 Maxwell G <[email protected]>
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
"""
5+
Module entrypoint
6+
"""
7+
8+
from __future__ import annotations
9+
10+
from .cli import APP
11+
12+
if __name__ == "__main__":
13+
APP()

0 commit comments

Comments
 (0)