-
Notifications
You must be signed in to change notification settings - Fork 335
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
Create update-required-checks script #1060
Conversation
echo "Updating v1" | ||
gh api --silent -X "PATCH" repos/github/codeql-action/branches/releases/v1/protection/required_status_checks --input checks.json | ||
|
||
rm check.json |
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.
rm check.json | |
rm checks.json |
echo "Updating main" | ||
gh api --silent -X "PATCH" repos/github/codeql-action/branches/main/protection/required_status_checks --input checks.json | ||
echo "Updating v2" | ||
gh api --silent -X "PATCH" repos/github/codeql-action/branches/releases/v2/protection/required_status_checks --input checks.json | ||
echo "Updating v1" | ||
gh api --silent -X "PATCH" repos/github/codeql-action/branches/releases/v1/protection/required_status_checks --input checks.json |
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.
You could do this in a loop:
for BRANCH in main releases/v2 releases/v1; do
...
done
# Update the required checks based on the current branch. | ||
# Typically, this will be main. | ||
|
||
# NOTE: This script can only be run by someone with admin rights on this repo. |
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.
As a quick failsafe in the script, you can check whether GITHUB_TOKEN
is non-empty. Otherwise the first call to gh api
will pause and ask for user login.
65b476d
to
0fa3d09
Compare
This also removes the .github/workflows/update-required-checks.yml workflow. This script needs to be run locally by someone who has admin privileges on the repo.
0fa3d09
to
827fd55
Compare
@aeisenberg Could we update the |
Sure...I'll take care of that in another PR. |
This also removes the .github/workflows/update-required-checks.yml
workflow. This script needs to be run locally by someone who has
admin privileges on the repo.