Open issue on OWASP failures (#3038)
This commit is contained in:
Родитель
6b83440ad6
Коммит
9442a58882
|
@ -29,3 +29,11 @@ jobs:
|
|||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: agent/agent/build/reports
|
||||
|
||||
scheduled-job-notification:
|
||||
needs:
|
||||
- analyze
|
||||
if: always()
|
||||
uses: ./.github/workflows/reusable-scheduled-job-notification.yml
|
||||
with:
|
||||
success: ${{ needs.analyze.result == 'success' }}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
name: Reusable - Scheduled job notification
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
success:
|
||||
type: boolean
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
notify-if-needed:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Open issue or add comment if issue already open
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
number=$(gh issue list --search "Workflow failed: $GITHUB_WORKFLOW" --limit 1 --json number -q .[].number)
|
||||
|
||||
echo $number
|
||||
echo ${{ inputs.success }}
|
||||
|
||||
if [[ $number ]]; then
|
||||
if [[ ${{ inputs.success }} == "true" ]]; then
|
||||
gh issue close $number
|
||||
else
|
||||
gh issue comment $number \
|
||||
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
|
||||
fi
|
||||
elif [[ !${{ inputs.success }} ]]; then
|
||||
gh issue create --title "Workflow failed: $GITHUB_WORKFLOW (#$GITHUB_RUN_NUMBER)" \
|
||||
--label bug \
|
||||
--body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
|
||||
fi
|
Загрузка…
Ссылка в новой задаче