Skip to content

Add sign-off to backport commits - #1151

Merged
tdas merged 1 commit into
mainfrom
backport-action2
Nov 5, 2025
Merged

tdas merged 1 commit into
mainfrom
backport-action2

Conversation

@tdas

@tdas tdas commented Nov 4, 2025 •

Copy link
Copy Markdown
Contributor

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description 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:

  • Extracts the original commit author's name and email from each backport branch
  • Amends the commit with --signoff flag using the original author's credentials
  • Force pushes the updated branch

This ensures all backported commits include proper sign-off from the original author.

@tdas
tdas requested a review from openinx November 4, 2025 08:52

@openinx openinx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So the backport-{pr-number}-to-{target-branch} branch name is naturally coming from the korthout/backport-action@v3 I think.

https://github.com/korthout/backport-action?tab=readme-ov-file#branch_name

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point!

git config user.email "$author_email"

# Amend with signoff and force push
git commit --amend --no-edit --signoff

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@tdas tdas Nov 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds good, thanks for the explanation !


# Amend with signoff and force push
git commit --amend --no-edit --signoff
git push --force origin "$branch"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Will the workflow have the enough permissions to force push, act as the original author ? I'm not sure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@tdas tdas Nov 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 ?

@tdas tdas Nov 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

@tdas
tdas force-pushed the backport-action2 branch from ff641f8 to f783a53 Compare November 5, 2025 08:10
addressed comments

Signed-off-by: Tathagata Das <[email protected]>
@tdas
tdas force-pushed the backport-action2 branch from f783a53 to 2fe5ffa Compare November 5, 2025 08:12
@tdas
tdas merged commit 0127a80 into main Nov 5, 2025
@openinx
openinx deleted the backport-action2 branch March 27, 2026 22:11
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

Successfully merging this pull request may close these issues.

2 participants