Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr_labeler: re-architect triager script #1882

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

gotmax23
Copy link
Collaborator

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.

Review note

The only code changes are the CI configuration, the pyproject.toml, and the new requirements file. The other code is largely the same, just split out into separate files.

I did some testing in https://github.com/gotmax23/ansible-documentation/actions/workflows/labeler.yml.

@gotmax23 gotmax23 added the tooling This PR affects tooling (CI, pr_labeler, noxfile, linters, etc.) but not the docs builds themselves. label Sep 13, 2024
.github/workflows/labeler.yml Show resolved Hide resolved
.github/workflows/labeler.yml Show resolved Hide resolved
hacking/pr_labeler/pyproject.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @gotmax23 Think there are some conflicts to fix before we can merge though.

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.
@gotmax23 gotmax23 merged commit 7138e42 into ansible:devel Sep 17, 2024
9 checks passed
@gotmax23 gotmax23 added backport-2.15 Automatically create a backport for the stable-2.15 branch backport-2.14 Automatically create a backport for the stable-2.14 branch backport-2.16 Automatically create a backport for the stable-2.16 branch backport-2.17 Automatically create a backport for the stable-2.17 branch labels Sep 17, 2024
Copy link

patchback bot commented Sep 17, 2024

Backport to stable-2.14: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 7138e42 on top of patchback/backports/stable-2.14/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882

Backporting merged PR #1882 into devel

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/ansible-documentation.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-2.14/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882 upstream/stable-2.14
  4. Now, cherry-pick PR pr_labeler: re-architect triager script #1882 contents into that branch:
    $ git cherry-pick -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
    If it'll yell at you with something like fatal: Commit 7138e42716a7a33fb87d5bf6ce590fa9ec291f68 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR pr_labeler: re-architect triager script #1882 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-2.14/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Copy link

patchback bot commented Sep 17, 2024

Backport to stable-2.17: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 7138e42 on top of patchback/backports/stable-2.17/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882

Backporting merged PR #1882 into devel

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/ansible-documentation.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-2.17/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882 upstream/stable-2.17
  4. Now, cherry-pick PR pr_labeler: re-architect triager script #1882 contents into that branch:
    $ git cherry-pick -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
    If it'll yell at you with something like fatal: Commit 7138e42716a7a33fb87d5bf6ce590fa9ec291f68 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR pr_labeler: re-architect triager script #1882 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-2.17/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Copy link

patchback bot commented Sep 17, 2024

Backport to stable-2.15: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 7138e42 on top of patchback/backports/stable-2.15/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882

Backporting merged PR #1882 into devel

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/ansible-documentation.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-2.15/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882 upstream/stable-2.15
  4. Now, cherry-pick PR pr_labeler: re-architect triager script #1882 contents into that branch:
    $ git cherry-pick -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
    If it'll yell at you with something like fatal: Commit 7138e42716a7a33fb87d5bf6ce590fa9ec291f68 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR pr_labeler: re-architect triager script #1882 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-2.15/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Copy link

patchback bot commented Sep 17, 2024

Backport to stable-2.16: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 7138e42 on top of patchback/backports/stable-2.16/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882

Backporting merged PR #1882 into devel

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible/ansible-documentation.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-2.16/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882 upstream/stable-2.16
  4. Now, cherry-pick PR pr_labeler: re-architect triager script #1882 contents into that branch:
    $ git cherry-pick -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
    If it'll yell at you with something like fatal: Commit 7138e42716a7a33fb87d5bf6ce590fa9ec291f68 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 7138e42716a7a33fb87d5bf6ce590fa9ec291f68
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR pr_labeler: re-architect triager script #1882 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-2.16/7138e42716a7a33fb87d5bf6ce590fa9ec291f68/pr-1882
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

gotmax23 added a commit to gotmax23/ansible-documentation that referenced this pull request Sep 17, 2024
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)
gotmax23 added a commit that referenced this pull request Sep 17, 2024
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)
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this pull request Sep 17, 2024
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)
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this pull request Sep 17, 2024
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)
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this pull request Sep 18, 2024
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)
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this pull request Sep 18, 2024
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)
gotmax23 added a commit to gotmax23/ansible-documentation that referenced this pull request Sep 18, 2024
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)
oraNod pushed a commit that referenced this pull request Sep 20, 2024
* 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>
oraNod pushed a commit that referenced this pull request Sep 20, 2024
* 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>
oraNod pushed a commit that referenced this pull request Sep 20, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-2.14 Automatically create a backport for the stable-2.14 branch backport-2.15 Automatically create a backport for the stable-2.15 branch backport-2.16 Automatically create a backport for the stable-2.16 branch backport-2.17 Automatically create a backport for the stable-2.17 branch tooling This PR affects tooling (CI, pr_labeler, noxfile, linters, etc.) but not the docs builds themselves.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants