-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Add workflow to check help wanted
labelling
#11105
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
Add workflow to check help wanted
labelling
#11105
Conversation
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.
Pull Request Overview
Adds an automated check that comments on pull requests addressing issues which lack the help-wanted
label, in order to enforce the project’s contribution guidelines (fixes #11100).
- Introduces a Bash script (
check-help-wanted.sh
) to inspect linked issues for thehelp-wanted
label and post a comment if missing. - Adds a GitHub Actions workflow (
pr-help-wanted.yml
) to run the script on newly opened PRs (excluding bots and org members).
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
.github/workflows/scripts/check-help-wanted.sh | New script to fetch closing issues, verify labels, and comment when missing |
.github/workflows/pr-help-wanted.yml | Workflow that triggers the script for new PRs and skips bots/org members |
Comments suppressed due to low confidence (3)
.github/workflows/pr-help-wanted.yml:30
- The workflow references the script at
.github/scripts/check-help-wanted.sh
but the file is located under.github/workflows/scripts/
. Update the path tobash .github/workflows/scripts/check-help-wanted.sh
to match the actual location.
bash .github/scripts/check-help-wanted.sh ${{ github.event.pull_request.html_url }}
.github/workflows/pr-help-wanted.yml:24
- The second condition is quoted, so the
gh api
command never runs. Remove the quotes aroundgh api orgs/cli/public_members/${PR_AUTHOR}
so that the command executes properly (if [ ... ] || gh api ... --silent
).
if [ "$PR_AUTHOR_TYPE" = "Bot" ] || "gh api orgs/cli/public_members/${PR_AUTHOR}" --silent 2>/dev/null
.github/workflows/scripts/check-help-wanted.sh:1
- This script contains branching logic (no PR URL, missing labels, all labeled) but there are no tests or dry-run validations to ensure it behaves as expected. Consider adding unit tests or a test workflow to cover key scenarios.
#!/bin/bash
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.
LGTM! 🙏 with a few suggestions.
if [ -z "$CLOSING_ISSUES" ]; then | ||
echo "No closing issues found for PR #$PRNUM" | ||
exit 0 | ||
fi |
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.
Shouldn't we do something in this case? Most spam PRs will end up here.
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.
What would you suggest we do?
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.
Maybe just a comment that this PR does not have a corresponding issue? However, that is kind of out of the scope of the script (at least how it's named to handle help-wanted cases). So, we can leave it as is, I think.
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.
suggest: updating any echo
of output as notice / warning / error commands will make them show up on the Actions run summary, making them easier to find without digging into the logs and preserved when the logs expire
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.
Maybe just a comment that this PR does not have a corresponding issue? However, that is kind of out of the scope of the script (at least how it's named to handle help-wanted cases). So, we can leave it as is, I think.
I agree this is a bit out of scope of this workflow, but an interesting thing to dig into later.
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.
suggest: updating any
echo
of output as notice / warning / error commands will make them show up on the Actions run summary, making them easier to find without digging into the logs and preserved when the logs expire
@andyfeller do you feel strongly about including this? If so, could you please help progress this by pushing a commit with what you're recommending?
Personally, I always find myself looking at the raw logs anyways since I find these workflow annotations tend to not include all the information that the logs would by their very nature.
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.
This looks really good! My only questions relate to the auth used with minor suggestions or thoughts in some places
if [ -z "$CLOSING_ISSUES" ]; then | ||
echo "No closing issues found for PR #$PRNUM" | ||
exit 0 | ||
fi |
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.
suggest: updating any echo
of output as notice / warning / error commands will make them show up on the Actions run summary, making them easier to find without digging into the logs and preserved when the logs expire
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
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.
Reviewed this again only to find a leftover call to gh pr comment
that I had missed. Removed it, and now it LGTM.
Thank you for your pull request! 🎉 This PR appears to fix the following issues that are not labeled with As outlined in our Contributing Guidelines, we expect that PRs are only created for issues that have been labeled While we appreciate your initiative, please note that:
What happens next:
Thank you for your understanding and contribution to the project! 🙏 This comment was automatically generated by cliAutomation. |
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.
Easy to follow and appreciate being able to test it out locally!
The only concerning question is whether this should filter closing issue references for cli/cli
or not. I will defer to you if this is enhanced further versus following up based on experience.
if: !github.event.pull_request.draft | ||
run: | | ||
# Skip if PR is from a bot or org member | ||
if [ "$PR_AUTHOR_TYPE" = "Bot" ] || "gh api orgs/cli/public_members/${PR_AUTHOR}" --silent 2>/dev/null |
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.
thought: I always forget =
is considered identical to ==
, resulting in a double take. I know this is used in other places, so just an errant thought to help others.
if [ -z "$CLOSING_ISSUES" ]; then | ||
echo "No closing issues found for PR #$PR_NUM" | ||
exit 0 | ||
fi |
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.
thought: given this script is focused on checking help wanted, I suspect we rely upon other automation to deal with the situation where there are no closing issues:
cli/.github/workflows/prauto.yml
Lines 70 to 73 in e7a558e
if ! grep -Eq '(#|issues/)[0-9]+' <<<"$PRBODY" | |
then | |
commentPR "Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message." | |
fi |
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.
I think we should probably combine the two workflows into one general PR handling one but I think it makes sense to follow up because I think we're going to want to tear that one out of the workflow file.
on: | ||
pull_request_target: | ||
types: [opened] |
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.
question: should this workflow run again when the PR is edited
or reopened
as the user updates the PR body or reopened after closed?
I'm just thinking through the scenarios in depth, so not a blocking question but one that comes to mind. 🤔
For more information:
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.
See notes section of the issue: #11100 (comment)
Co-authored-by: Andy Feller <andyfeller@github.com>
help wanted
labelling
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | patch | `v2.74.1` -> `v2.74.2` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.74.2`](https://github.com/cli/cli/releases/tag/v2.74.2): GitHub CLI 2.74.2 [Compare Source](cli/cli@v2.74.1...v2.74.2) #### What's Changed ##### 🐛 Fixes - Fix assignees being dropped from `gh pr edit` by [@​BagToad](https://github.com/BagToad) in cli/cli#11065 - Add accurate context when run rerun fails by [@​leudz](https://github.com/leudz) in cli/cli#10774 - Avoid requesting MR reviewer twice by [@​williammartin](https://github.com/williammartin) in cli/cli#11099 - Quote filenames suggested at the end of worklow run by [@​williammartin](https://github.com/williammartin) in cli/cli#11134 - Fix expected error output of TestRepo/repo-rename-transfer-ownership by [@​aconsuegra](https://github.com/aconsuegra) in cli/cli#10888 ##### 📚 Docs & Chores - Add instructions for MidnightBSD installation by [@​laffer1](https://github.com/laffer1) in cli/cli#10699 - docs: update install command for Debian by [@​MagneticNeedle](https://github.com/MagneticNeedle) in cli/cli#10935 - Fix step order for CodeQL workflow by [@​BagToad](https://github.com/BagToad) in cli/cli#11145 - Add workflow to check `help wanted` labelling by [@​williammartin](https://github.com/williammartin) in cli/cli#11105 - Quote workflow conditional by [@​williammartin](https://github.com/williammartin) in cli/cli#11122 - Fix script path for help-wanted check by [@​BagToad](https://github.com/BagToad) in cli/cli#11125 - Exclude 3rd party license compliance content from GHAS scanning by [@​andyfeller](https://github.com/andyfeller) in cli/cli#11127 - Second fix for file not found in help-wanted check by [@​BagToad](https://github.com/BagToad) in cli/cli#11128 - Ensure gh executes in workflow check script by [@​williammartin](https://github.com/williammartin) in cli/cli#11133 - Improve help wanted check skipping logic by [@​BagToad](https://github.com/BagToad) in cli/cli#11135 #####Dependencies - Bump go to 1.24 by [@​williammartin](https://github.com/williammartin) in cli/cli#11142 - chore(deps): bump mislav/bump-homebrew-formula-action from 3.2 to 3.4 by [@​dependabot](https://github.com/dependabot) in cli/cli#11066 - chore(deps): bump github.com/sigstore/protobuf-specs from 0.4.2 to 0.4.3 by [@​dependabot](https://github.com/dependabot) in cli/cli#11092 - chore(deps): bump google.golang.org/grpc from 1.72.0 to 1.72.2 by [@​dependabot](https://github.com/dependabot) in cli/cli#11033 - chore(deps): bump actions/attest-build-provenance from 2.3.0 to 2.4.0 by [@​dependabot](https://github.com/dependabot) in cli/cli#11107 - chore(deps): bump github.com/in-toto/attestation from 1.1.1 to 1.1.2 by [@​dependabot](https://github.com/dependabot) in cli/cli#11123 - chore(deps): bump github.com/google/go-containerregistry from 0.20.3 to 0.20.6 by [@​dependabot](https://github.com/dependabot) in cli/cli#11120 - Bump golangci-lint to v2 by [@​williammartin](https://github.com/williammartin) in cli/cli#11121 #### New Contributors - [@​MagneticNeedle](https://github.com/MagneticNeedle) made their first contribution in cli/cli#10935 - [@​laffer1](https://github.com/laffer1) made their first contribution in cli/cli#10699 **Full Changelog**: cli/cli@v2.74.1...v2.74.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC42MC4xIiwidXBkYXRlZEluVmVyIjoiNDAuNjAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Description
Fixes #11100