Skip to content
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 Test Env Require Approval Action #3005

Merged
merged 5 commits into from
Oct 1, 2024
Merged

Add Test Env Require Approval Action #3005

merged 5 commits into from
Oct 1, 2024

Conversation

peterzhuamazon
Copy link
Member

Description

Add Test Env Require Approval Action.

Every time when a PR get created:

  1. If PR author is not part of .github/CODEOWNERS, assign ml-commons-cicd-env-required-approval, pending for review by the assigned maintainers of the env.
  2. If PR author is a maintainer, then assign ml-commons-cicd-env, no need approval.
  3. If it is a merge which resulted in a push, ml-commons-cicd-env assigned, no need approval.

Example waiting for approval by maintainer: #3004.

Thanks.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@peterzhuamazon
Copy link
Member Author

peterzhuamazon commented Sep 30, 2024

Adding @ylwu-amzn @dhrubo-os to take a look.

Note you need to merge this PR before it take effect as it is Pull_Request_Target event.

Thanks.

Signed-off-by: Peter Zhu <[email protected]>
echo "Push event does not need approval"
echo "is-require-approval=ml-commons-cicd-env" >> $GITHUB_OUTPUT
else
approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So currently, it's maintainers vs non-maintainers, right?

not maintainers + organization vs non-maintainers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is easier to get maintainers list, we will start from here and improve.

approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')
author=${{ github.event.pull_request.user.login }}
if [[ "$approvers" =~ "$author" ]]; then
echo "$authoer is in the approval list"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] author

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks.

Copy link
Collaborator

@ylwu-amzn ylwu-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Peter for enhancing this

@dhrubo-os dhrubo-os merged commit 9de2d23 into main Oct 1, 2024
11 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 1, 2024
* Add require approval stage so only maintainers can start CI stage without approval

Signed-off-by: Peter Zhu <[email protected]>

* Add more

Signed-off-by: Peter Zhu <[email protected]>

* Add more

Signed-off-by: Peter Zhu <[email protected]>

* Add old files

Signed-off-by: Peter Zhu <[email protected]>

* Update require-approval.yml

Signed-off-by: Peter Zhu <[email protected]>

---------

Signed-off-by: Peter Zhu <[email protected]>
(cherry picked from commit 9de2d23)
@peterzhuamazon peterzhuamazon deleted the test/env-approval branch October 1, 2024 04:17
dhrubo-os pushed a commit that referenced this pull request Oct 1, 2024
* Add require approval stage so only maintainers can start CI stage without approval

Signed-off-by: Peter Zhu <[email protected]>

* Add more

Signed-off-by: Peter Zhu <[email protected]>

* Add more

Signed-off-by: Peter Zhu <[email protected]>

* Add old files

Signed-off-by: Peter Zhu <[email protected]>

* Update require-approval.yml

Signed-off-by: Peter Zhu <[email protected]>

---------

Signed-off-by: Peter Zhu <[email protected]>
(cherry picked from commit 9de2d23)

Co-authored-by: Peter Zhu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants