-
Notifications
You must be signed in to change notification settings - Fork 417
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
Added ability to pass in an optional PR number as a parameter #349
Added ability to pass in an optional PR number as a parameter #349
Conversation
Hello, @credfeto! First of all, I want to thank you for the time and effort you've put into creating this pull request. We greatly appreciate contributions from our community and we recognize the value they bring to the continual improvement of our project. Regarding your changes, I appreciate your insights and your attempt to refine the workings of the labeler action. However, it's worth noting that in the current setup, any PR created triggers the As for the issue you have mentioned, the proper way to label pull requests which were created before adding the labeler workflow would be pulling changes from the main branch (the newly added workflow) to your branch - that will trigger the If I have missed any other use cases, feel free to propose them for consideration. Best regards. |
@AndreiLobanovich, my use case is slightly different - I've got a github action that creates a PR - which uses the - id: open-pr
uses: repo-sync/pull-request@v2.12
with:
source_branch: "" # If blank, default: triggered branch
destination_branch: "main" # If blank, default: master
pr_assignee: ${{github.actor}} # Comma-separated list (no spaces)
pr_label: "auto-pr" # Comma-separated list (no spaces)
pr_draft: ${{env.CREATE_DRAFT}} # Creates pull request as draft
pr_title: ${{env.COMMIT_MSG}}
pr_body: ${{steps.pr-template.outputs.content}}
github_token: ${{github.token}}
## using forked verson of actions/labeler to get the pr_number that was created to add labels
- uses: credfeto/labeler@feature/pass-in-pull-request-or-issue
with:
repo-token: ${{secrets.SOURCE_PUSH_TOKEN}}
configuration-path: .github/labeler.yml
sync-labels: true
pr-number: ${{steps.open-pr.outputs.pr_number}} |
Hey, @credfeto, I have tested your implementation, it works well. Also, we have a feature request for labeling multiple pull request with a single run. We think that making this input able to accept not only a single pr number but also a list of pr numbers is a way to go. Could you implement this functionality?
Additionally, please, consider adding checks for the input data. |
@AndreiLobanovich, thanks. I'll take a look at adding the multiple PRs and the validation. WRT the validation how far should i go - e.g - is it enough to check that its a valid positive number, or should it validate that it is an [open?] PR or issue? |
@credfeto I think we should check the input if it's a positive number and try to get the PR. If retrieval fails there should be a |
234b29b
to
8800c89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your effort! Just a few minor changes needed.
Hello @credfeto! |
All's fine - I've just been busy the last couple of weeks - just need to pick things up again fix up the issues reported. Hopefully will get that done today or tomorrow |
8800c89
to
13ad946
Compare
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
I think I've addressed all your comments above; let me know if there's anything I've missed |
@MaksimZhukov Fixed the tests - had to revert one of the suggested fixes to get it to work |
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
The comments were resolved
Thank you @credfeto for the contribution! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/labeler](https://github.com/actions/labeler) | action | minor | `v4.2.0` -> `v4.3.0` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the logs for more information. --- ### Release Notes <details> <summary>actions/labeler (actions/labeler)</summary> ### [`v4.3.0`](https://github.com/actions/labeler/releases/tag/v4.3.0) [Compare Source](https://github.com/actions/labeler/compare/v4.2.0...v4.3.0) #### What's Changed In scope of this release, the ability to specify pull request number(s) was added by [@​credfeto](https://github.com/credfeto) in [https://github.com/actions/labeler/pull/349](https://github.com/actions/labeler/pull/349). Support for reading from the configuration file presented on the runner was added by [@​lrstanley](https://github.com/lrstanley) in [https://github.com/actions/labeler/pull/394](https://github.com/actions/labeler/pull/394). It allows you to use a configuration file generated during workflow run or uploaded from a separate repository. Please refer to the [action documentation](https://github.com/actions/labeler#inputs) for more information. This release also includes the following changes: - Improved Error message for missing config file by [@​Gornoka](https://github.com/Gornoka) in [https://github.com/actions/labeler/pull/475](https://github.com/actions/labeler/pull/475) - Early exit when no files are changed by [@​nathanhammond](https://github.com/nathanhammond) in [https://github.com/actions/labeler/pull/456](https://github.com/actions/labeler/pull/456) - Add examples to match all repo files by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/600](https://github.com/actions/labeler/pull/600) - Fix a typo in the example about using the action outputs by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/606](https://github.com/actions/labeler/pull/606) - Bump eslint from 8.43.0 to 8.44.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/601](https://github.com/actions/labeler/pull/601) - Bump [@​typescript-eslint/parser](https://github.com/typescript-eslint/parser) from 5.60.1 to 5.61.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/602](https://github.com/actions/labeler/pull/602) - Bump [@​typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin) from 5.60.1 to 5.61.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/604](https://github.com/actions/labeler/pull/604) - Bump tough-cookie from 4.1.2 to 4.1.3 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/609](https://github.com/actions/labeler/pull/609) - Bump [@​octokit/plugin-retry](https://github.com/octokit/plugin-retry) from 5.0.4 to 5.0.5 by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/610](https://github.com/actions/labeler/pull/610) #### New Contributors - [@​credfeto](https://github.com/credfeto) made their first contribution in [https://github.com/actions/labeler/pull/349](https://github.com/actions/labeler/pull/349) - [@​lrstanley](https://github.com/lrstanley) made their first contribution in [https://github.com/actions/labeler/pull/394](https://github.com/actions/labeler/pull/394) - [@​nathanhammond](https://github.com/nathanhammond) made their first contribution in [https://github.com/actions/labeler/pull/456](https://github.com/actions/labeler/pull/456) **Full Changelog**: actions/labeler@v4...v4.3.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/owntracks/android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi41LjMiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/labeler](https://github.com/actions/labeler) | action | minor | `v4.2.0` -> `v4.3.0` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the logs for more information. --- ### Release Notes <details> <summary>actions/labeler (actions/labeler)</summary> ### [`v4.3.0`](https://github.com/actions/labeler/releases/tag/v4.3.0) [Compare Source](https://github.com/actions/labeler/compare/v4.2.0...v4.3.0) #### What's Changed In scope of this release, the ability to specify pull request number(s) was added by [@​credfeto](https://github.com/credfeto) in [https://github.com/actions/labeler/pull/349](https://github.com/actions/labeler/pull/349). Support for reading from the configuration file presented on the runner was added by [@​lrstanley](https://github.com/lrstanley) in [https://github.com/actions/labeler/pull/394](https://github.com/actions/labeler/pull/394). It allows you to use a configuration file generated during workflow run or uploaded from a separate repository. Please refer to the [action documentation](https://github.com/actions/labeler#inputs) for more information. This release also includes the following changes: - Improved Error message for missing config file by [@​Gornoka](https://github.com/Gornoka) in [https://github.com/actions/labeler/pull/475](https://github.com/actions/labeler/pull/475) - Early exit when no files are changed by [@​nathanhammond](https://github.com/nathanhammond) in [https://github.com/actions/labeler/pull/456](https://github.com/actions/labeler/pull/456) - Add examples to match all repo files by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/600](https://github.com/actions/labeler/pull/600) - Fix a typo in the example about using the action outputs by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/606](https://github.com/actions/labeler/pull/606) - Bump eslint from 8.43.0 to 8.44.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/601](https://github.com/actions/labeler/pull/601) - Bump [@​typescript-eslint/parser](https://github.com/typescript-eslint/parser) from 5.60.1 to 5.61.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/602](https://github.com/actions/labeler/pull/602) - Bump [@​typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin) from 5.60.1 to 5.61.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/604](https://github.com/actions/labeler/pull/604) - Bump tough-cookie from 4.1.2 to 4.1.3 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/609](https://github.com/actions/labeler/pull/609) - Bump [@​octokit/plugin-retry](https://github.com/octokit/plugin-retry) from 5.0.4 to 5.0.5 by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/610](https://github.com/actions/labeler/pull/610) #### New Contributors - [@​credfeto](https://github.com/credfeto) made their first contribution in [https://github.com/actions/labeler/pull/349](https://github.com/actions/labeler/pull/349) - [@​lrstanley](https://github.com/lrstanley) made their first contribution in [https://github.com/actions/labeler/pull/394](https://github.com/actions/labeler/pull/394) - [@​nathanhammond](https://github.com/nathanhammond) made their first contribution in [https://github.com/actions/labeler/pull/456](https://github.com/actions/labeler/pull/456) **Full Changelog**: actions/labeler@v4...v4.3.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/owntracks/android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi41LjMiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/labeler](https://github.com/actions/labeler) | action | minor | `v4.2.0` -> `v4.3.0` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the logs for more information. --- ### Release Notes <details> <summary>actions/labeler (actions/labeler)</summary> ### [`v4.3.0`](https://github.com/actions/labeler/releases/tag/v4.3.0) [Compare Source](https://github.com/actions/labeler/compare/v4.2.0...v4.3.0) #### What's Changed In scope of this release, the ability to specify pull request number(s) was added by [@​credfeto](https://github.com/credfeto) in [https://github.com/actions/labeler/pull/349](https://github.com/actions/labeler/pull/349). Support for reading from the configuration file presented on the runner was added by [@​lrstanley](https://github.com/lrstanley) in [https://github.com/actions/labeler/pull/394](https://github.com/actions/labeler/pull/394). It allows you to use a configuration file generated during workflow run or uploaded from a separate repository. Please refer to the [action documentation](https://github.com/actions/labeler#inputs) for more information. This release also includes the following changes: - Improved Error message for missing config file by [@​Gornoka](https://github.com/Gornoka) in [https://github.com/actions/labeler/pull/475](https://github.com/actions/labeler/pull/475) - Early exit when no files are changed by [@​nathanhammond](https://github.com/nathanhammond) in [https://github.com/actions/labeler/pull/456](https://github.com/actions/labeler/pull/456) - Add examples to match all repo files by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/600](https://github.com/actions/labeler/pull/600) - Fix a typo in the example about using the action outputs by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/606](https://github.com/actions/labeler/pull/606) - Bump eslint from 8.43.0 to 8.44.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/601](https://github.com/actions/labeler/pull/601) - Bump [@​typescript-eslint/parser](https://github.com/typescript-eslint/parser) from 5.60.1 to 5.61.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/602](https://github.com/actions/labeler/pull/602) - Bump [@​typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin) from 5.60.1 to 5.61.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/604](https://github.com/actions/labeler/pull/604) - Bump tough-cookie from 4.1.2 to 4.1.3 by [@​dependabot](https://github.com/dependabot) in [https://github.com/actions/labeler/pull/609](https://github.com/actions/labeler/pull/609) - Bump [@​octokit/plugin-retry](https://github.com/octokit/plugin-retry) from 5.0.4 to 5.0.5 by [@​MaksimZhukov](https://github.com/MaksimZhukov) in [https://github.com/actions/labeler/pull/610](https://github.com/actions/labeler/pull/610) #### New Contributors - [@​credfeto](https://github.com/credfeto) made their first contribution in [https://github.com/actions/labeler/pull/349](https://github.com/actions/labeler/pull/349) - [@​lrstanley](https://github.com/lrstanley) made their first contribution in [https://github.com/actions/labeler/pull/394](https://github.com/actions/labeler/pull/394) - [@​nathanhammond](https://github.com/nathanhammond) made their first contribution in [https://github.com/actions/labeler/pull/456](https://github.com/actions/labeler/pull/456) **Full Changelog**: actions/labeler@v4...v4.3.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/owntracks/android). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi41LjMiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
So so it can be used in a workflow that creates a PR automatically like
repo-sync/pull-request
then add in labels at creation rather than having to run an additional workflowAlso would fix #304