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

.github/workflows: add rebase-staging.yml #107520

Merged
merged 1 commit into from Dec 28, 2020
Merged

.github/workflows: add rebase-staging.yml #107520

merged 1 commit into from Dec 28, 2020

Conversation

zowoq
Copy link
Contributor

@zowoq zowoq commented Dec 24, 2020

This allows committers to rebase PRs to staging without CODEOWNER notification spam or running git commands manually.

cc @FRidh @jonringer @zimbatm

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

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

Sounds like a great idea!

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

I like it.

How do we trigger it?

@FRidh
Copy link
Member

FRidh commented Dec 24, 2020

How do we trigger it?

You need to comment /rebase-staging. This best be explicitly mentioned in the action, along with a motivation for it.

Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

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

👍 I like the idea.

  • How can this be documented so that people know about its existence? (maybe update the PR template?)
  • Did you try this out? I'm not sure that it would work for third-party contributors.

.github/workflows/rebase-staging.yml Show resolved Hide resolved
@zowoq
Copy link
Contributor Author

zowoq commented Dec 24, 2020

How can this be documented so that people know about its existence? (maybe update the PR template?)

I don't think that this needs to be documented on the PR template or anywhere else really, it's a committers only tool.

I'm not sure that it would work for third-party contributors.

I don't understand what you mean?

@Mic92
Copy link
Member

Mic92 commented Dec 25, 2020

How can this be documented so that people know about its existence? (maybe update the PR template?)

I don't think that this needs to be documented on the PR template or anywhere else really, it's a committers only tool.

I'm not sure that it would work for third-party contributors.

I don't understand what you mean?

I think only maintainers needs to be aware of this as they demand branch switches most of the time. I think we had something in the nixpkgs manual for rebasing.

@zowoq
Copy link
Contributor Author

zowoq commented Dec 25, 2020

I think we had something in the nixpkgs manual for rebasing.

Nothing that covers changing base branches. Also I don't think the nixpkgs manual would be good place for this, maybe a separate doc that can be linked from the README and/or .github/CONTRIBUTING.md that can consolidates the existing CI/staging mentions we have there and can also cover github specific stuff like actions?

@zowoq zowoq merged commit 32ee74c into NixOS:master Dec 28, 2020
@zowoq zowoq deleted the rebase-staging branch December 28, 2020 22:44
@zowoq
Copy link
Contributor Author

zowoq commented Dec 28, 2020

Seems to work but I've noticed what may be a problem.

The actions that run in pull requests (editorconfig, wait-for-ofborg) seem to be skipped when the PR is pushed to by another action. IIRC this is done intentionally by github.

Actions in staging-next PRs also seem to skipped when the pushes are from the merge-staging sync.

@zowoq
Copy link
Contributor Author

zowoq commented Jan 3, 2021

@SuperSandro2000 The action will now add a 👀 to the comment that initiated it.


The proper workaround for allowing actions to trigger other actions seems to be running the first action from another account/token so we would need to add one from somewhere to the repo secrets.

If we don't want to fuss with that (at least for now) we could do this:

diff --git a/.github/workflows/rebase-staging.yml b/.github/workflows/rebase-staging.yml
index 8214787778e..2758675b250 100644
--- a/.github/workflows/rebase-staging.yml
+++ b/.github/workflows/rebase-staging.yml
@@ -48,6 +48,17 @@ jobs:
             -H "Authorization: token $GITHUB_TOKEN" \
             -d '{ "base": "staging" }' \
             "https://api.github.com/repos/NixOS/nixpkgs/pulls/$PULL_REQUEST"
+          curl \
+            -X PATCH \
+            -H "Accept: application/vnd.github.v3+json" \
+            -H "Authorization: token $GITHUB_TOKEN" \
+            -d '{ "state": "closed" }' \
+            "https://api.github.com/repos/NixOS/nixpkgs/pulls/$PULL_REQUEST"
+      - uses: peter-evans/create-or-update-comment@v1
+        with:
+          issue-number: ${{ github.event.issue.number }}
+          body: |
+            Rebased, please reopen the pull request.
       - uses: peter-evans/create-or-update-comment@v1
         if: ${{ failure() }}
         with:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2021

Failed to rebase on staging

@zowoq
Copy link
Contributor Author

zowoq commented Jan 29, 2021

Updated version with a fix for running other actions, also allows rebasing PRs onto other branches: #110843

@zowoq
Copy link
Contributor Author

zowoq commented Jun 8, 2021

PR to remove: #126192

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

Successfully merging this pull request may close these issues.

None yet

5 participants