-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[infra] Automation: Add release PR reviewers #12982
Merged
michelengelen
merged 5 commits into
mui:master
from
michelengelen:automation/add-release-reviewers
May 3, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
451e9d6
adds an action to automatically assign all maintainers of the x-team …
michelengelen 9c877a4
changed label name to 'release' :P
michelengelen 1763dce
Update add-release-reviewers.yml
michelengelen 6cc3cdc
changed version to hash
michelengelen 938b9b5
changed gh cli approach to curl
michelengelen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Add reviewers to release PRs | ||
|
||
on: | ||
pull_request_target: | ||
branches: ['master', 'next'] | ||
types: ['labeled'] | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
add-reviewers: | ||
if: ${{ github.event.label.name == 'release' }} | ||
# Tests that label is added on the PR | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- id: get-members | ||
uses: garnertb/get-team-members@0482f68c88601800f85145570ea93bf8fcfcf46f | ||
with: | ||
org: mui | ||
team_slug: x | ||
role: maintainer | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# assign reviewers | ||
- name: Add reviewer | ||
run: | | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer <YOUR-TOKEN>" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ | ||
-d '{"reviewers":[${{ steps.get-members.outputs.members }}]}' \ | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
This is probably not going to work. 🙈
Have you checked cli/cli#7671? 🤔
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.
interesting ... need to look into this ... thanks for pointing it out
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 seems promissing
cli/cli#4844 (comment)
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 used the curl approach for the API, since the gh cli seemingly does not allow for passing in an array of strings 🤷🏼
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.
Well, it might still fail as the suggestion here: cli/cli#4844 (comment) specifies the write permissions. 🤔
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.
yeah ... it did fail, but for another reason! :D