diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d76e6305e..30d97e631 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -70,6 +70,6 @@ jobs: needs: - analyze if: always() && github.event_name == 'schedule' - uses: ./.github/workflows/reusable-workflow-notification.yml + uses: open-telemetry/shared-workflows/.github/workflows/workflow-failure-issue.yml@70659e38ed50e743a5cce6fb40ba336c40154aa1 # v0.3.0 with: success: ${{ needs.analyze.result == 'success' }} diff --git a/.github/workflows/reusable-workflow-notification.yml b/.github/workflows/reusable-workflow-notification.yml deleted file mode 100644 index e31c875cf..000000000 --- a/.github/workflows/reusable-workflow-notification.yml +++ /dev/null @@ -1,43 +0,0 @@ -# this is useful because notifications for scheduled workflows are only sent to the user who -# initially created the given workflow -name: Reusable - Workflow notification - -on: - workflow_call: - inputs: - success: - type: boolean - required: true - -permissions: - contents: read - -jobs: - workflow-notification: - permissions: - contents: read - issues: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - - name: Open issue or add comment if issue already open - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - number=$(gh issue list --search "in:title 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 }}" == "false" ]]; then - gh issue create --title "Workflow failed: $GITHUB_WORKFLOW (#$GITHUB_RUN_NUMBER)" \ - --body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)." - fi