mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-11 23:28:59 +00:00
.github: Fix issues with cherry-pick-reminder
This commit is contained in:
56
.github/workflows/PROpenedOrUpdated.yml
vendored
56
.github/workflows/PROpenedOrUpdated.yml
vendored
@@ -22,17 +22,41 @@ jobs:
|
|||||||
AsteriskUnitTests:
|
AsteriskUnitTests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Add cherry-pick reminder
|
- name: Get Token needed to add reviewers
|
||||||
|
if: github.event.action == 'opened'
|
||||||
|
id: get_workflow_token
|
||||||
|
uses: peter-murray/workflow-application-token-action@v1
|
||||||
|
with:
|
||||||
|
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
|
||||||
|
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
|
||||||
|
organization: asterisk
|
||||||
|
|
||||||
|
- name: Add cherry-pick reminder and reviewers
|
||||||
if: github.event.action == 'opened'
|
if: github.event.action == 'opened'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
||||||
|
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
||||||
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
|
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
|
||||||
|
REVIEWERS: ${{vars.PR_REVIEWERS}}
|
||||||
run: |
|
run: |
|
||||||
|
IFS=$'; \n'
|
||||||
|
for r in $REVIEWERS ; do
|
||||||
|
echo "Adding reviewer $r"
|
||||||
|
gh pr edit --repo ${{github.repository}} ${PR_NUMBER} --add-reviewer $r || :
|
||||||
|
done
|
||||||
# If there's already a reminder comment, don't add another one.
|
# If there's already a reminder comment, don't add another one.
|
||||||
gh pr view --json comments \
|
ADD_COMMENT=true
|
||||||
--jq ".comments[].body | select(. | startswith(\"${CHERRY_PICK_REMINDER:0:20}\")) | halt_error(1)" \
|
# This query will FAIL if it finds the comment.
|
||||||
${{env.PR_NUMBER}} >/dev/null 2>&1 || exit 0
|
gh pr view --repo ${{github.repository}} --json comments \
|
||||||
gh pr comment --repo ${{github.repository}} -b "${CHERRY_PICK_REMINDER}" ${{env.PR_NUMBER}}
|
--jq '.comments[].body | select(. | startswith("<!--CPR-->")) | halt_error(1)' \
|
||||||
|
${{env.PR_NUMBER}} >/dev/null 2>&1 || ADD_COMMENT=false
|
||||||
|
if $ADD_COMMENT ; then
|
||||||
|
echo "Adding CPR comment"
|
||||||
|
gh pr comment --repo ${{github.repository}} \
|
||||||
|
-b "${CHERRY_PICK_REMINDER}" ${{env.PR_NUMBER}}
|
||||||
|
else
|
||||||
|
echo "CPR comment already present"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Set Labels
|
- name: Set Labels
|
||||||
env:
|
env:
|
||||||
@@ -60,27 +84,11 @@ jobs:
|
|||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
unittest_command: ${{vars.UNITTEST_COMMAND}}
|
unittest_command: ${{vars.UNITTEST_COMMAND}}
|
||||||
|
|
||||||
- name: Get Token needed to add reviewers
|
- name: Add Checks Passed Label
|
||||||
if: ${{ success() }}
|
|
||||||
id: get_workflow_token
|
|
||||||
uses: peter-murray/workflow-application-token-action@v1
|
|
||||||
with:
|
|
||||||
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
|
|
||||||
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
|
|
||||||
organization: asterisk
|
|
||||||
|
|
||||||
- name: Add Reviewers
|
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
|
|
||||||
REVIEWERS: ${{vars.PR_REVIEWERS}}
|
|
||||||
run: |
|
run: |
|
||||||
echo "${{env.GITHUB_ACTION}} Add reviewers"
|
|
||||||
IFS=$'; \n'
|
|
||||||
for r in $REVIEWERS ; do
|
|
||||||
gh pr edit --repo ${ASTERISK_REPO} ${PR_NUMBER} --add-reviewer $r || :
|
|
||||||
done
|
|
||||||
gh pr edit --repo ${{github.repository}} \
|
gh pr edit --repo ${{github.repository}} \
|
||||||
--add-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
|
--add-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
|
||||||
${{env.PR_NUMBER}} || :
|
${{env.PR_NUMBER}} || :
|
||||||
|
Reference in New Issue
Block a user