Skip to content

Adds signoff to backport workflow#9

Open
JoshVanL wants to merge 1 commit intodapr:mainfrom
JoshVanL:backport-signoff
Open

Adds signoff to backport workflow#9
JoshVanL wants to merge 1 commit intodapr:mainfrom
JoshVanL:backport-signoff

Conversation

@JoshVanL
Copy link

No description provided.

Signed-off-by: joshvanl <me@joshvanl.dev>
Copilot AI review requested due to automatic review settings March 11, 2026 16:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a post-processing step to the reusable backport workflow to amend created backport commits with a DCO Signed-off-by trailer, aiming to keep backported commits compliant with DCO requirements.

Changes:

  • Checks out the repository after running tibdex/backport.
  • Iterates over backport branches for the merged PR and amends the latest commit with --signoff, then force-pushes the updated commit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

with:
github_token: ${{ secrets.dapr_bot_token }}
- uses: actions/checkout@v4
with:
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

actions/checkout is using the default GITHUB_TOKEN, but this reusable workflow sets permissions: {} and the later git push will therefore run without a token that can write to origin. As a result, the force-push is very likely to fail. Pass ${{ secrets.dapr_bot_token }} to actions/checkout (and keep credentials persisted) or otherwise configure git credentials so that pushes authenticate with the bot token.

Suggested change
with:
with:
token: ${{ secrets.dapr_bot_token }}
persist-credentials: true

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +56
AUTHOR_NAME=$(git log -1 --format='%an')
AUTHOR_EMAIL=$(git log -1 --format='%ae')
git -c user.name="${AUTHOR_NAME}" -c user.email="${AUTHOR_EMAIL}" commit --amend --signoff --no-edit
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

This only amends HEAD, so if the backport branch contains multiple commits (e.g., a rebase-merged PR with several commits), only the last commit gets a DCO signoff and earlier commits remain unsigned. If the intent is to ensure DCO compliance for the whole backport, update the workflow to add signoffs to all commits on the backport branch (for example by rebasing with signoff or otherwise rewriting each commit), then force-push once.

Suggested change
AUTHOR_NAME=$(git log -1 --format='%an')
AUTHOR_EMAIL=$(git log -1 --format='%ae')
git -c user.name="${AUTHOR_NAME}" -c user.email="${AUTHOR_EMAIL}" commit --amend --signoff --no-edit
TARGET_BRANCH="${BRANCH#backport-${PR_NUMBER}-to-}"
git fetch origin "${TARGET_BRANCH}"
AUTHOR_NAME=$(git log -1 --format='%an')
AUTHOR_EMAIL=$(git log -1 --format='%ae')
GIT_COMMITTER_NAME="${AUTHOR_NAME}" GIT_COMMITTER_EMAIL="${AUTHOR_EMAIL}" git rebase --signoff "origin/${TARGET_BRANCH}"

Copilot uses AI. Check for mistakes.
- name: Add DCO signoff to backport commits
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
for BRANCH in $(git ls-remote --heads origin | grep "backport-${PR_NUMBER}-to-" | awk '{print $2}' | sed 's|refs/heads/||'); do
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The branch discovery pipeline uses grep with a regular expression; using a fixed-string match (grep -F) (or anchoring the pattern) would avoid any accidental regex interpretation and make the intent clearer when matching backport-${PR_NUMBER}-to-... branch names.

Suggested change
for BRANCH in $(git ls-remote --heads origin | grep "backport-${PR_NUMBER}-to-" | awk '{print $2}' | sed 's|refs/heads/||'); do
for BRANCH in $(git ls-remote --heads origin | grep -F "backport-${PR_NUMBER}-to-" | awk '{print $2}' | sed 's|refs/heads/||'); do

Copilot uses AI. Check for mistakes.
@acroca
Copy link
Member

acroca commented Mar 16, 2026

I added -s to #7 to sign cherry-picks. Should cover this, right?

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.

3 participants