Repository navigation
Add sign-off to backport commits - #1151
Conversation
openinx
left a comment
There was a problem hiding this comment.
Just left serveral questions, may no need to change. Approved for later changes.
| pr_number="${{ github.event.pull_request.number }}" | ||
|
|
||
| # Find all backport branches for this PR | ||
| # The backport action creates branches named backport-{pr-number}-to-{target-branch} |
There was a problem hiding this comment.
So the backport-{pr-number}-to-{target-branch} branch name is naturally coming from the korthout/backport-action@v3 I think.
Could you please a comment here, for the first glance, I was not aware that and confused. After did the google search , just get it.
| git config user.email "$author_email" | ||
|
|
||
| # Amend with signoff and force push | ||
| git commit --amend --no-edit --signoff |
There was a problem hiding this comment.
So the backport PR's credit is for author of original PR, right ? If there is any conflict, we still require the original author to resolve them, right ? will the one who trigger the backport workflow have the permission to resolve them. ( I mean the one who trigger the backport, may is not exactly the one who contributed the original PR, then what's the collaboration process for them).
Just curious.
There was a problem hiding this comment.
Good question. if there is a conflict, I think there are two possible approaches
- original author can close the auto-generated backport PR and create a new PR and proceed.
- a committer who has write access to the repo can push changes to the branch with signoff.
My goal is to make the simple, non-conflict case super easy.
There was a problem hiding this comment.
Sounds good, thanks for the explanation !
|
|
||
| # Amend with signoff and force push | ||
| git commit --amend --no-edit --signoff | ||
| git push --force origin "$branch" |
There was a problem hiding this comment.
Will the workflow have the enough permissions to force push, act as the original author ? I'm not sure.
There was a problem hiding this comment.
good point. i cant test it without actually merging it but i can see that this will be a problem. adding the token used earlier.
There was a problem hiding this comment.
claude thinks it should work because of the token setting in the checkout@v4 action above is setting the
From the GitHub Actions Checkout README:
On the token parameter:
"Personal access token (PAT) used to fetch the repository. The PAT is configured with the local git config, which enables your scripts to
run authenticated git commands."
On the persist-credentials parameter (which defaults to true):
"Whether to configure the token or SSH key with the local git config
So yes, when you use actions/checkout@v4 with token: ${{ secrets.BACKPORT_ACTION_TOKEN }}, it automatically configures the local git
config with that token, and subsequent git operations (like git push --force) will use that authentication. The persist-credentials
option defaults to true, so the credentials remain available throughout your workflow.
There was a problem hiding this comment.
So the CI directly push it to the backport-{pr-number}-to-{target-branch} in the official unitycatalog/unitycatalog repo, or a separate forked repo ? Seems like it's the former one, right ? Then when do we need to clean the stale branches once we merged the backport PR.
There was a problem hiding this comment.
yes. main repo. once we confirm this is working as intended, I can do a follow up PR that adds a actoin to delete backport PR branches that have been merged and are more then 30 days old. sounds good?
|
|
||
| # Find all backport branches for this PR | ||
| # The backport action creates branches named backport-{pr-number}-to-{target-branch} | ||
| backport_branches=$(git branch -r | grep "origin/backport-${pr_number}-to-" | sed 's/origin\///' | sed 's/^[[:space:]]*//' | xargs) |
There was a problem hiding this comment.
A related question is: will those backport branches be maintained in the offical oss unitycatalog ? After the backport PR get merged, will those stale branched be cleaned automatically ?
There was a problem hiding this comment.
good question. once we confirm this is working as intended, I can do a follow up PR that adds a actoin to delete backport PR branches that have been merged and are more then 30 days old. sounds good?
ff641f8 to
f783a53
Compare
addressed comments Signed-off-by: Tathagata Das <[email protected]>
f783a53 to
2fe5ffa
Compare
PR Checklist
docsis updatedDescription of changes
Follow up of - #1148
It created this backport PR - #1150
But the problem is that the commit in the backported PR dont have the signoff. So even if there are no conflicts, the PR cannot be readily merged.
So I modified the backport GitHub action to automatically amend backport commits with sign-off. The workflow now:
--signoffflag using the original author's credentialsThis ensures all backported commits include proper sign-off from the original author.