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

Could the bot merge master? #21

Closed
bkchr opened this issue Jan 4, 2024 · 6 comments
Closed

Could the bot merge master? #21

bkchr opened this issue Jan 4, 2024 · 6 comments
Assignees

Comments

@bkchr
Copy link
Member

bkchr commented Jan 4, 2024

When the branch is out of date, it looks like auto merge is waiting. It would be nice if in such a situation the bot just merges master.

@bkchr
Copy link
Member Author

bkchr commented Jan 4, 2024

CC @Bullrich

See polkadot-fellows/runtimes#114 (comment) as an example.

@Bullrich Bullrich self-assigned this Jan 4, 2024
@Bullrich
Copy link
Contributor

Bullrich commented Jan 5, 2024

Hi @bkchr!

I have been running some experiments on this and, unfortunately, it can not be done 😞

This is because a GitHub action can only modify a branch that belongs to the repository, and PRs to polkadot-fellows/runtimes are done from a fork, which does not belong to the repository.

Could not update pull request due to an authorisation error. This is probably because this pull request is from a fork and the current token does not have write access to the forked repository. Error was: Resource not accessible by integration

I tried with the existing action autoupdate which provides exactly the features that you need but also had the same problem.


A possible solution for this could be merge-queues which @alvicsam has implemented in paritytech/polkadot-sdk. It requires a trickier setup, but it was developed for this particular purpose.

Let me know what you think.

@bkchr
Copy link
Member Author

bkchr commented Jan 5, 2024

And what is with this? https://github.com/adRise/update-pr-branch

@Bullrich
Copy link
Contributor

Bullrich commented Jan 5, 2024

And what is with this? https://github.com/adRise/update-pr-branch

This one uses a different method. Seems to be kind of new (we didn't knew about it and had only tried with the old fashioned method).

Update a Pull Request Branch.

Thanks, it seems that this could be the solution for our problem!

I experimented with it and noticed different behaviours based on this checkbox:
image

If it is off, it throws an error:

Error: Fail to update PR with error: HttpError: user doesn't have permission to update head repository

If it is on, it works by default.

The only problem that I see is that it doesn't have error handling of a failed case, so if one of the PRs have this check disabled, it will throw the whole process.

The task itself is quite small. I think I can make a small action using this method that will fulfill this requirements in no time.

Bullrich added a commit to Bullrich/polkadot-fellows-runtimes that referenced this issue Jan 10, 2024
Added action to keep pull requests up to date. Every time master receives a push, it will look for all the PRs and sync them with the master branch.

This only works when the PR has `auto-merge` enabled (it can be enabled for all PRs too if required).

Merging this PR will count as solving paritytech/auto-merge-bot#21 and paritytech/up-to-date-action#1

We use a github app to solve the issue that tests would not run if the credentials comes from a github action.
@Bullrich
Copy link
Contributor

A PR with the action has been created in polkadot-fellows/runtimes#139.

It uses the newly created action up-to-date

bkchr pushed a commit to polkadot-fellows/runtimes that referenced this issue Jan 10, 2024
Added action to keep pull requests up to date. Every time master
receives a push, it will look for all the PRs and sync them with the
master branch.

This only works when the PR has `auto-merge` enabled (it can be enabled
for all PRs too if required).

Merging this PR will count as solving paritytech/auto-merge-bot#21 and
paritytech/up-to-date-action#1

We use a github app to solve the issue that tests would not run if the
credentials comes from a github action.

I'm resuing the credentials for the
[`fellowship-merge-bot`](https://github.com/apps/fellowship-merge-bot)
used in
[`auto-merge`](https://github.com/polkadot-fellows/runtimes/blob/main/.github/workflows/auto-merge.yml).

It needs to have the following permissions:
- Repository permissions:
  - Pull Requests
    - [x] Write
  - Contents
    - [x] Write
@Bullrich
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants