Skip to content

Commit

Permalink
devops: fix cherry-pick bot
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Aug 11, 2022
1 parent d12afa7 commit 34dd80c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/cherry_pick_into_release_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ jobs:
ref: release-${{ github.event.inputs.version }}
fetch-depth: 0
- name: Cherry-pick commits
id: cherry-pick
run: |
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
for COMMIT_HASH in $(echo "${{ github.event.inputs.commit_hashes }}" | tr "," "\n"); do
git cherry-pick --no-commit "$COMMIT_HASH"
Expand All @@ -40,7 +43,7 @@ jobs:
process.exit(0);
}
console.log(`chery-pick${match[2]}: ${match[1]}`);
' $(git show -s --format=%B $COMMIT_HASH))
' "$(git show -s --format=%B $COMMIT_HASH))"
git commit -m "$COMMIT_MESSAGE"
done
Expand All @@ -51,22 +54,20 @@ jobs:
run: |
BRANCH_NAME="cherry-pick-${{ github.event.inputs.version }}-$(date +%Y-%m-%d-%H-%M-%S)"
echo "::set-output name=BRANCH_NAME::$BRANCH_NAME"
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout -b "$BRANCH_NAME"
git push origin $BRANCH_NAME
- name: Create Pull Request
uses: actions/github-script@v6
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
script: |
const readableCommitHashesList = '${{ github.event.inputs.commit_hashes }}'.split(',').map(hash => `- ${hash}`).join('\n');
const response = await github.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'main',
title: '${{ steps.prepare-branch.outputs.PR_TITLE }}',
base: 'release-${{ github.event.inputs.version }}',
title: '${{ steps.cherry-pick.outputs.PR_TITLE }}',
body: `This PR cherry-picks the following commits:\n\n${readableCommitHashesList}`,
});
await github.issues.addLabels({
Expand Down

0 comments on commit 34dd80c

Please sign in to comment.