Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Support rebasing PR from forks and allow only selected users to rebase #17

Merged
merged 3 commits into from
Feb 12, 2020

Conversation

drdanz
Copy link
Contributor

@drdanz drdanz commented Sep 20, 2019

Support rebasing PR from forks

This works only if the "Allow edit from maintainers" option is checked
and the GITHUB_TOKEN variable is set using a developer token, i.e.

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_OAUTH_TOKEN }}

Fixes #12

Use the user name and email for committer name

Instead of using a generic name and address, fetch these information
from using the GitHub API.

Allow user based tokens

If an environment variable <user_login>_TOKEN exists, that variable is
used instead of GITHUB_TOKEN.

This makes it possible to allow only some users to rebase the PRs by
setting

  env:
    <user1>_TOKEN: ${{ secrets.<user1>_TOKEN }}
    <user2>_TOKEN: ${{ secrets.<user2>_TOKEN }}

drdanz added a commit to robotology/yarp that referenced this pull request Sep 24, 2019
This works only if the "Allow edit from maintainers" option is checked
and the `GITHUB_TOKEN` variable is set using a developer token, i.e.

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_OAUTH_TOKEN }}
Instead of using a generic name and address, fetch these information
from using the GitHub API.
If an environment variable `<user_login>_TOKEN` exists, that variable is
used instead of `GITHUB_TOKEN`.

This makes it possible to allow only some users to rebase the PRs by
setting

  env:
    <user1>_TOKEN: ${{ secrets.<user1>_TOKEN }}
    <user2>_TOKEN: ${{ secrets.<user2>_TOKEN }}
@drdanz
Copy link
Contributor Author

drdanz commented Sep 27, 2019

rebased over latest master

Copy link
Member

@fkorotkov fkorotkov left a comment

Choose a reason for hiding this comment

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

Sorry for a delayed review! The notification about the PR got lost.


git remote set-url origin https://x-access-token:$COMMITTER_TOKEN@github.com/$GITHUB_REPOSITORY.git
git config --global user.email "$USER_EMAIL"
git config --global user.name "$USER_NAME"
Copy link
Member

Choose a reason for hiding this comment

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

I think you should do the user customization here only if USER_TOKEN is defined. Otherwise you should fall back to the original logic. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest I'd like to be able to know who started the rebase...

@ycjcl868
Copy link

/rebase

1 similar comment
@ycjcl868
Copy link

ycjcl868 commented Oct 7, 2019

/rebase

@ghost
Copy link

ghost commented Dec 25, 2019

/rebase

@drdanz drdanz mentioned this pull request Jan 14, 2020
@mikeparker
Copy link

@fkorotkov any blockers to merging this? This seems to solve a very important use case :)

@fkorotkov
Copy link
Member

@mikeparker I just don't like that "solution" but unfortunately it seems there is no other way to support it at the moment.

@fkorotkov fkorotkov merged commit 347ae6f into cirrus-actions:master Feb 12, 2020
vorburger added a commit to vorburger/rebase that referenced this pull request May 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support PRs from fork
4 participants