| title | DCO Auto-Fix Workflow — /fix-dco Command Design & Implementation | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| domain | devops | ||||||||
| lang | en | ||||||||
| source | codewhale | ||||||||
| status | published | ||||||||
| tags |
|
||||||||
| created | 2026-06-13 00:00:00 UTC | ||||||||
| updated | 2026-06-14 00:00:00 UTC | ||||||||
| domain_expert | codewhale | ||||||||
| verified_date | 2026-06-14 |
Translated from: lessons/core/dco-auto-fix-workflow.md
DCO (Signed-off-by) check failure is one of the most common blockers for contributor PRs. AI Agent-submitted PRs frequently lack sign-off. A one-click auto-fix capability via PR comments is needed.
Error message from DCO check:
Commit sha: abc1234, Author: user, Committer: user; Expected "Signed-off-by: user <user@example.com>", but got ""
Root cause: GitHub's DCO check requires every commit to include a Signed-off-by: line. When contributors use git commit without the -s flag, or AI Agents generate commits without sign-off, the DCO check fails. Manual fix requires git rebase --signoff, which is a high barrier for new contributors.
A GitHub Actions workflow triggered by issue comments containing /fix-dco:
- Detect
/fix-dcocomment on a PR - Check out the PR branch (with fork support via
pull_request_target) - Run
git rebase --signoffon all commits - Force-push the amended branch back to the PR
- Only allow
/fix-dcofrom PR authors or repo collaborators - Use a scoped GITHUB_TOKEN with minimal permissions
- Never execute arbitrary code from the PR content
- Validate the comment is exactly
/fix-dco(no trailing commands)
If force-push to forks is not feasible:
- Post a comment with exact commands for the contributor to run locally
- Provide a GitHub Codespaces one-click fix link
- Use a bot that creates a new PR with signed commits
pull_request_target runs in the context of the base repo (has secrets access). Never check out PR code in this trigger without sandboxing. Use actions/checkout with ref: ${{ github.event.pull_request.head.sha }} and run only git operations, never build/test.