Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
jobs:
backport:
permissions:
contents: write # for Git to git push
contents: write # for git push to PR branch
runs-on: ubuntu-latest
steps:
- run: |
Expand Down Expand Up @@ -48,6 +48,15 @@ jobs:

git checkout -b $branch
git cherry-pick $commit

if git diff --name-only HEAD~1 HEAD | grep -q '^\.github/workflows/'; then
echo "::error::This PR contains changes to workflow files (.github/workflows/)."
echo "::error::Workflow files cannot be automatically backported because the standard"
echo "::error::GitHub token doesn't have the required 'workflow' write permission."
echo "::error::Please backport this PR manually."
exit 1
fi

git push --set-upstream origin $branch
gh pr create --title "[$GITHUB_REF_NAME] $title" \
--body "Clean cherry-pick of #$NUMBER to the \`$GITHUB_REF_NAME\` branch." \
Expand Down
Loading