Skip to content

Commit be4be30

Browse files
authored
[github actions] ping actor of workflow on cherry pick pr creation (#142676)
Context: Follow up from sync with @itsjustkevin today. Tag and ping the actor of workflow, when the cherry pick pull request is successfully created. 1. actor of workflow will be the username of the user that triggered the initial workflow run. i.e., whoever labels the PR. This person might not necessarily be the author of the cherry pick PR. 2. PR number of newly created cherry pick PR is parsed from the output of "gh pr create" as a multi line string. Tested: on cp success: flutter/flutter#142674 pings the actor of workflow (not the pr author). on cp failure: [example workflow](https://github.com/XilaiZhang/miscellaneous-side-project/actions/runs/7734400373/job/21088324523) leaves a msg on the original PR.
1 parent 2c0cf44 commit be4be30

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/easy-cp.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,26 @@ jobs:
5757
- name: Create PR on CP success
5858
if: ${{ steps.attempt-cp.conclusion == 'success' }}
5959
working-directory: ./flutter
60+
id: create-pr
6061
run: |
6162
git push https://${{ env.GITHUB_TOKEN }}@github.com/flutteractionsbot/flutter cp-${CHANNEL}-${COMMIT_SHA}
62-
gh pr create --title "[CP-${CHANNEL}]${PR_TITLE}" --body-file ../PULL_REQUEST_CP_TEMPLATE.md --base ${RELEASE_BRANCH} --label "cp: review" --repo flutter/flutter --head flutteractionsbot:cp-${CHANNEL}-${COMMIT_SHA}
63+
{
64+
echo 'PR_URL<<EOF'
65+
gh pr create --title "[CP-${CHANNEL}]${PR_TITLE}" --body-file ../PULL_REQUEST_CP_TEMPLATE.md --base ${RELEASE_BRANCH} --label "cp: review" --repo flutter/flutter --head flutteractionsbot:cp-${CHANNEL}-${COMMIT_SHA}
66+
echo EOF
67+
} >> "$GITHUB_ENV"
6368
env:
6469
GITHUB_TOKEN: ${{ secrets.FLUTTERACTIONSBOT_CP_TOKEN }}
6570
PR_TITLE: ${{ github.event.pull_request.title }}
71+
- name: Leave Comment on CP success
72+
if: ${{ steps.create-pr.conclusion == 'success' }}
73+
run: |
74+
echo $PR_URL
75+
NEW_PR_NUMBER="${PR_URL##*/}"
76+
SUCCESS_MSG=" @${{ github.actor }} please fill out the PR description above, afterwards the release team will review this request."
77+
gh pr comment $NEW_PR_NUMBER -R flutter/flutter -b "${SUCCESS_MSG}"
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.FLUTTERACTIONSBOT_CP_TOKEN }}
6680
- name: Leave Comment on CP failure
6781
if: ${{ failure() && steps.attempt-cp.conclusion == 'failure' }}
6882
run: |

0 commit comments

Comments
 (0)