Skip to content

Commit 57eb7e2

Browse files
committed
.github: Don't add cherry-pick reminder if it's already present
1 parent 659f2aa commit 57eb7e2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

.github/workflows/PROpenedOrUpdated.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@ jobs:
2626
if: github.event.action == 'opened'
2727
env:
2828
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
2930
run: |
30-
cat <<-EOF | gh pr comment --repo ${{github.repository}} ${{env.PR_NUMBER}} -F -
31-
REMINDER: If this PR applies to other branches, please add a
32-
comment with the appropriate "cherry-pick-to" headers as per
33-
the [Create a Pull Request](https://wiki.asterisk.org/wiki/display/AST/Code+Contribution#CodeContribution-CreateaPullRequest) process.
34-
If you don't want it cherry-picked, please add a comment stating
35-
"No cherry-picks required" so we don't keep asking.
36-
37-
If, after adding "cherry-pick-to" comments, you change your mind,
38-
please edit the comment to DELETE the header lines and add
39-
"No cherry-picks required".
40-
EOF
31+
# If there's already a reminder comment, don't add another one.
32+
gh pr view --json comments \
33+
--jq ".comments[].body | select(. | startswith(\"${CHERRY_PICK_REMINDER:0:20}\")) | halt_error(1)" \
34+
${{env.PR_NUMBER}} >/dev/null 2>&1 || exit 0
35+
gh pr comment --repo ${{github.repository}} -b "${CHERRY_PICK_REMINDER}" ${{env.PR_NUMBER}}
4136
4237
- name: Set Labels
4338
env:

0 commit comments

Comments
 (0)