-
-
Notifications
You must be signed in to change notification settings - Fork 643
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 github action to assign milestone automatically #16779
Conversation
fd2cee3
to
9b3e6b0
Compare
WalkthroughThis update introduces a new GitHub Actions workflow designed to automatically assign a default milestone to closed issues and pull requests. Triggered upon closure, the workflow checks if a milestone is already set and assigns a specified milestone if none is present, improving project tracking and organization. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub
participant Workflow
participant API
GitHub->>Workflow: Trigger on issue/pull request close
Workflow->>API: Check if milestone is set
API-->>Workflow: Milestone status
alt Milestone not set
Workflow->>API: Assign default milestone
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 as PR comments)
Additionally, you can add 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: 1
env: | ||
MILESTONE_ID: 1 | ||
|
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.
Parameterize or document the milestone ID.
The milestone ID is hardcoded to 1
. This should either be parameterized to allow flexibility or documented to ensure it is updated appropriately during release cycles.
env:
MILESTONE_ID: ${{ secrets.MILESTONE_ID }}
Ensure to add MILESTONE_ID
to the repository secrets.
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 should be an environment variable not a secret
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.
@seanbudd, understood. You can set the MILESTONE_ID
as an environment variable in the workflow file. Here's an updated snippet for the workflow:
name: Assign Milestone on Close
env:
MILESTONE_ID: 1 # Update this value as needed for each release cycle
This ensures that the milestone ID can be easily updated during release cycles without requiring it to be a secret.
Learnings added
Learnt from: seanbudd
PR: nvaccess/nvda#16779
File: .github/workflows/assign-milestone-on-close.yml:0-0
Timestamp: 2024-08-02T07:28:45.462Z
Learning: For the GitHub Actions workflow in the NVDA repository, use environment variables for configuration values like `MILESTONE_ID` instead of secrets.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
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.
can you make this so it's an environment variable set through GitHub, not hard coded
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.
"""
"""
@seanbudd, understood. You can set the MILESTONE_ID
as an environment variable through GitHub's repository settings. Here’s how you can do it:
- Go to your repository on GitHub.
- Click on the "Settings" tab.
- In the left sidebar, click on "Environments".
- Create a new environment or select an existing one.
- Add the
MILESTONE_ID
environment variable with the appropriate value.
Then, in your workflow file, you can reference this environment variable as follows:
name: Assign Milestone on Close
env:
MILESTONE_ID: ${{ vars.MILESTONE_ID }}
This ensures that the MILESTONE_ID
is managed through GitHub's environment settings, providing flexibility and ease of updates.
Learnings added
Learnt from: seanbudd
PR: nvaccess/nvda#16779
File: .github/workflows/assign-milestone-on-close.yml:0-0
Timestamp: 2024-08-02T07:28:45.462Z
Learning: For the GitHub Actions workflow in the NVDA repository, use environment variables for configuration values like `MILESTONE_ID` instead of secrets and set them through GitHub's environment settings for better management.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
Learnings used
Learnt from: seanbudd
PR: nvaccess/nvda#16779
File: .github/workflows/assign-milestone-on-close.yml:0-0
Timestamp: 2024-08-02T07:28:45.632Z
Learning: For the GitHub Actions workflow in the NVDA repository, use environment variables for configuration values like `MILESTONE_ID` instead of secrets.
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 reasonable to me, though I've never worked on GitHub scripting before, so I can't be confident.
@seanbudd
Instead of depending on a human to set the milestone, can the milestone be derived from either the repo or git log?
Since an Action can set repo variables, I'm thinking that a separate workflow to run on every merge, to update the milestone if it should be changed, might be possible.
https://github.com/mmoyaferrer/set-github-variable
|
@XLTechie - I don't think so, no. We want to update this manually when we update |
…#16974) Fixup #16779 Summary of the issue: The GitHub actions to assign milestones to closed issues and PRs is failing for community PRs. This is because the action is looking in the forks repository for the milestone ID environment variable. Description of user facing changes Fixes assigning milestones to community contributions Description of development approach using the pull_request_target event rather than pull_request, uses the target (i.e. this) repositories environment variables.
Link to issue number:
None
Summary of the issue:
NV Access has a server side script to automatically assign milestones to closed issues and PRs. This script has been malfunctioning for some time meaning we are not tracking which release issues are closed in.
Description of user facing changes
Description of development approach
Used copilot to generate a github action to assign milestones.
Testing strategy
Manual testing
Known issues with pull request:
Code Review Checklist:
Summary by CodeRabbit