-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
GH Actions label adjustment, fix permissions and enable auto quarter labels #8078
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
Conversation
WalkthroughThe changes update the GitHub Actions workflow defined in the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (7)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/pr-auto-labeler.yml (1)
66-106
: Newlabel-by-date
job: Review and clarify quarter labeling logic.
A new job has been introduced to label pull requests based on their creation date. The job successfully extracts the month from the PR creation timestamp and assigns a label based on conditional checks. However, the conditional logic assigns labels using non-standard quarter markers (e.g.,"02"
for January, February, and December;"05"
for March–May;"08"
for June–August; and"11"
for September–November).
- Recommendation: If this mapping is intentional, consider adding an inline comment or documentation note explaining the rationale behind these specific label values. This will help future maintainers understand the grouping logic.
- The use of the GitHub CLI for authentication and label management is appropriate.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pr-auto-labeler.yml
(4 hunks)
🔇 Additional comments (3)
.github/workflows/pr-auto-labeler.yml (3)
11-15
: Addedissues: write
permission inlabel-remove
job.
The addition ofissues: write
alongside the existing permissions is correct and enables thePauMAVA/add-remove-label-action
to modify labels on issues.
27-32
: Addedissues: write
permission inlabel-category
job.
This change correctly complements the other permissions to allow label management with the add/remove label action.
43-48
: Addedissues: write
permission inlabel-size
job.
The updated permissions ensure that the size label action can properly add or remove labels, which aligns with the overall PR objective.
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.github/workflows/pr-auto-labeler.yml (3)
21-37
: Label Check and Removal Steps in "label-remove" Job
The step that checks for the "Ready to merge" label uses a combination ofcurl
,jq
, andgrep
to count label occurrences, then writes the result to the GitHub Actions output. This implementation is effective. Consider adding error handling for the API call (e.g., checking if the curl call fails or if the JSON parsing returns an error) to make the workflow more robust.
91-121
: Implementation of Labeling Based on Creation Date
The steps under the "label-by-date" job perform the following actions:
- Set environment variables for the GitHub token, PR creation date, issue number, and repository.
- Log the PR creation date and extract the numeric month using
date
withsed
—a reliable approach on Ubuntu runners.- Determine the label via a series of conditional checks:
- If the month is less than or equal to 2 or equal to 12, the label is set to
"02"
.- Else if the month is less than or equal to 5, the label becomes
"05"
.- Else if the month is less than or equal to 8, it sets
"08"
.- Otherwise, it uses
"11"
.Points to Verify & Consider:
- Quarter Logic Verification: The grouping of December (
12
) with months1
and2
to yield label"02"
may be unconventional given standard quarter divisions. Please verify that this grouping is intentional.- Readability Enhancement: For improved maintainability, consider refactoring the
if-elif
block into acase
statement.- Error Handling: It might be beneficial to add error handling for the GitHub CLI commands (
gh label create
andgh issue edit
) to gracefully handle failures.
101-114
: Optional: Refactor Quarter Determination Logic Using a Case Statement
For improved clarity and maintainability, you might refactor the month-to-label mapping as follows:- if [ "$MONTH" -le 2 ] || [ "$MONTH" -eq 12 ]; then - LABEL="02" - elif [ "$MONTH" -le 5 ]; then - LABEL="05" - elif [ "$MONTH" -le 8 ]; then - LABEL="08" - else - LABEL="11" - fi + case $MONTH in + 12|1|2) + LABEL="02" + ;; + 3|4|5) + LABEL="05" + ;; + 6|7|8) + LABEL="08" + ;; + 9|10|11) + LABEL="11" + ;; + *) + echo "Unexpected month value: $MONTH" && exit 1 + ;; + esacThis adjustment enhances readability while preserving the current logic.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/pr-auto-labeler.yml (4 hunks)
🔇 Additional comments (4)
.github/workflows/pr-auto-labeler.yml (4)
11-15
: Update Permissions in "label-remove" Job
The addition of theissues: write
permission in the "label-remove" job enables thePauMAVA/add-remove-label-action
to modify labels on issues. This change correctly aligns with the PR objective.
44-47
: Update Permissions in "label-category" Job
The update to includeissues: write
permission in the "label-category" job ensures that the associated action can manage labels correctly. This change is straightforward and meets the intended requirements.
60-63
: Update Permissions in "label-size" Job
Adding theissues: write
permission to the "label-size" job similarly empowers the action to add or remove labels as needed. This update is properly aligned with the overall PR objective.
82-88
: Introduction of the "label-by-date" Job
The new "label-by-date" job is configured with the necessary permissions (contents: read
andissues: write
) and runs onubuntu-latest
. This addition meets the PR objective of enabling label modifications based on the pull request creation date.
…labels (armbian#8078) * GH Actions: adjust permissions in order to change labels on PR * Add label by date, check if "Read to merge is present", fix bugs
Description
In title.
How Has This Been Tested?
Check list