File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,7 +101,18 @@ jobs:
101101 run : |
102102 BRANCH_NAME="${{ steps.findbranch.outputs.branch }}"
103103 git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
104- git commit -m "chore: update instrumentation list [automated]" || echo "No changes to commit."
104+ git commit -m "chore: update instrumentation list [automated]"
105+ # Metadata collection can run for hours, allowing workflow files on main to change after
106+ # checkout. GitHub then rejects pushing the stale branch without workflows: write, even
107+ # though the generated commit only changes docs/instrumentation-list.yaml. Merge instead
108+ # of rebase so that commit remains tied to its source snapshot while the pushed branch
109+ # contains the current workflow files.
110+ git fetch origin main
111+ if ! git merge --no-edit origin/main; then
112+ echo "::error::Failed to merge the latest origin/main into the generated metadata commit."
113+ git merge --abort
114+ exit 1
115+ fi
105116 git push --force origin "$BRANCH_NAME"
106117 git remote set-url origin "https://github.com/${{ github.repository }}.git"
107118
You can’t perform that action at this time.
0 commit comments