-
Notifications
You must be signed in to change notification settings - Fork 649
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
github workflow: enable workflow approval #632
Closed
ivanvc
wants to merge
1
commit into
etcd-io:master
from
ivanvc:enable-github-workflow-approval-via-ok-to-test-label
Closed
Changes from all commits
Commits
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,41 @@ | ||
--- | ||
name: Approve GitHub Workflows | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- labeled | ||
- synchronize | ||
branches: | ||
- main | ||
|
||
jobs: | ||
approve: | ||
name: Approve ok-to-test | ||
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
steps: | ||
- name: Update PR | ||
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | ||
continue-on-error: true | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
debug: ${{ secrets.ACTIONS_RUNNER_DEBUG == 'true' }} | ||
script: | | ||
const result = await github.rest.actions.listWorkflowRunsForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
event: "pull_request", | ||
status: "action_required", | ||
head_sha: context.payload.pull_request.head.sha, | ||
per_page: 100 | ||
}); | ||
for (var run of result.data.workflow_runs) { | ||
await github.rest.actions.approveWorkflowRun({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: run.id | ||
}); | ||
} |
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.
Note: there is no
main
branch in bbolt, instead it'smaster
.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.
Duh, you're right.
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.
Perhaps in future we should align the branch to main @ahrtr? I believe the procedure is pretty straightforward in GitHub. It makes sense to try and use same across all sig-etcd subprojects if possible 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.
I can leave both
main
andmaster
in the meantime, let me know what you think. So, when we rename the branch tomain
there's not gonna be a dependency 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.
OK, let me do it on weekend.
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.
cc @jmhbnz @serathius @wenjiaswe @fuweid @tjungblu @Elbehery
If there is no any objection, I will rename the
master
tomain
on weekend.Reference: https://www.git-tower.com/learn/git/faq/git-rename-master-to-main
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 can also do it easily from the GitHub repository settings page (ref: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch)
If it's fine with you, I'll revert my last change and set the branch name to
main
, and you can merge after you have renamed the main branch ✌️