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 auto-approve and auto merge into automatic update action #364

Merged
merged 13 commits into from
Sep 18, 2024

Conversation

Ukochka
Copy link
Contributor

@Ukochka Ukochka commented Sep 3, 2024

Add ability to auto approve PR created by grafana-plugin bot to be able to automerge

@Ukochka Ukochka self-assigned this Sep 3, 2024
@Ukochka Ukochka force-pushed the automerge-for-grafana-updates branch from 24f309a to 5139a74 Compare September 3, 2024 09:19
@Ukochka Ukochka marked this pull request as ready for review September 3, 2024 14:05
@Ukochka Ukochka requested review from a team as code owners September 3, 2024 14:05
@Ukochka Ukochka requested review from mckn, wbrowne, andresmgot and oshirohugo and removed request for a team September 3, 2024 14:05
uses: hmarr/auto-approve-action@v3
with:
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be token: ${{ steps.generate_token.outputs.token }} as above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it should not. Because if we are using the same token it thinks that it approves PR from itself. And it is not possible

Copy link
Collaborator

@jackw jackw left a comment

Choose a reason for hiding this comment

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

I'm probably missing something but how does this auto merge the PR?

.github/workflows/automatic-update.yml Outdated Show resolved Hide resolved
.github/workflows/automatic-update.yml Show resolved Hide resolved
@tolzhabayev
Copy link
Collaborator

I think you can skip the auto approve completely, as it doesn't make much of a difference.

SCR-20240905-kdwr

The bot user has the power to skip approvals and just merge it directly once the checks are green.

You would probably need something like https://github.com/re-actors/alls-green to ensure checks are actually green before merging.

A couple of examples on how to do it: https://jhale.dev/posts/auto-merging-prs/

@Ukochka
Copy link
Contributor Author

Ukochka commented Sep 5, 2024

@jackw Auto-merge option is already in github and it is enabled for this repo. When all the requirements are there - it will be automatically merged. I thought we need only approval, but I see that we actually need something else instead. @tolzhabayev shared the example

@tolzhabayev
Copy link
Collaborator

tolzhabayev commented Sep 5, 2024

I think auto merge is not actually auto merge but an option you have to click on while the CI pipeline is running so that it will be merged once its done. But if you do not "click the button" it will not actually merge anything - e.g. this PR is not automatically merged although approved and all checks are green.

@Ukochka
Copy link
Contributor Author

Ukochka commented Sep 5, 2024

@tolzhabayev yeah, that's why I was thinking auto-approve will help, but seems like no and we need to use auto-merge action to do so

@jackw
Copy link
Collaborator

jackw commented Sep 6, 2024

@Ukochka It seems we already have an action here that other repos are using to achieve this auto approve n merge of dependabot PRs?

Ukochka and others added 4 commits September 6, 2024 13:55
@CLAassistant
Copy link

CLAassistant commented Sep 6, 2024

CLA assistant check
All committers have signed the CLA.

@Ukochka
Copy link
Contributor Author

Ukochka commented Sep 10, 2024

@tolzhabayev @jackw Hey guys, I have added merge part to this github actions. And I left approval part just to be sure. I think all-green is not needed here, because auto-merge anyway checks if everything is passed as I understand

Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

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

Great work on this! Looks good 🙌🏻

With that said I'm not sure I think this feature is a good idea. Isn't it enough magic to get an PR with a updated create-plugin repository. If I would have this running in my repository I would disable this feature because I would like to be in control of when things like this gets merged.

@jackw
Copy link
Collaborator

jackw commented Sep 12, 2024

@mckn I'm under the impression this action is intended only for the examples repo and isn't for plugin developers to use in their repos.

.github/workflows/automatic-update.yml Show resolved Hide resolved
.github/workflows/automatic-update.yml Outdated Show resolved Hide resolved
.github/workflows/automatic-update.yml Show resolved Hide resolved
Copy link
Collaborator

@tolzhabayev tolzhabayev left a comment

Choose a reason for hiding this comment

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

Alright let's see this in action

Copy link
Collaborator

@jackw jackw left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@tolzhabayev
Copy link
Collaborator

@Ukochka fixed the CLA check #364 (comment)

@Ukochka Ukochka merged commit 84d5d0b into main Sep 18, 2024
20 checks passed
@Ukochka Ukochka deleted the automerge-for-grafana-updates branch September 18, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

6 participants