diff --git a/.github/templates/workflow-failed.md b/.github/templates/workflow-failed.md deleted file mode 100644 index b5b412cf14c4..000000000000 --- a/.github/templates/workflow-failed.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "{{ env.GITHUB_WORKFLOW }} #{{ env.GITHUB_RUN_NUMBER }} failed" -labels: bug, area:build, priority:p1 ---- - -{{ env.GITHUB_WORKFLOW }} #{{ env.GITHUB_RUN_NUMBER }} failed. Please take a look and fix it ASAP. diff --git a/.github/workflows/nightly-benchmark-overhead.yml b/.github/workflows/nightly-benchmark-overhead.yml index 9b43aea168dd..44a0b1aa3c9b 100644 --- a/.github/workflows/nightly-benchmark-overhead.yml +++ b/.github/workflows/nightly-benchmark-overhead.yml @@ -42,18 +42,5 @@ jobs: issue: name: Open issue on failure needs: run-overhead-tests - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/nightly-codeql-analysis.yml b/.github/workflows/nightly-codeql-analysis.yml index d19c4e175322..9db84ff693eb 100644 --- a/.github/workflows/nightly-codeql-analysis.yml +++ b/.github/workflows/nightly-codeql-analysis.yml @@ -37,18 +37,5 @@ jobs: issue: name: Open issue on failure needs: analyze - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/nightly-no-build-cache.yml b/.github/workflows/nightly-no-build-cache.yml index 44a0e86341ee..2896f08ddddb 100644 --- a/.github/workflows/nightly-no-build-cache.yml +++ b/.github/workflows/nightly-no-build-cache.yml @@ -49,18 +49,5 @@ jobs: issue: name: Open issue on failure needs: [ build, test, testLatestDeps, smoke-test, examples ] - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2acc4f51d120..19112e4c9987 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -70,18 +70,5 @@ jobs: issue: name: Open issue on failure needs: [ build, test, testLatestDeps, smoke-test, examples, markdown-link-check, markdown-misspell-check ] - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/publish-smoke-test-fake-backend-images.yml b/.github/workflows/publish-smoke-test-fake-backend-images.yml index ea6fbdbee5a9..0a3b5861b9bf 100644 --- a/.github/workflows/publish-smoke-test-fake-backend-images.yml +++ b/.github/workflows/publish-smoke-test-fake-backend-images.yml @@ -73,18 +73,5 @@ jobs: issue: name: Open issue on failure needs: [ publishLinux, publishWindows ] - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/publish-smoke-test-grpc-images.yml b/.github/workflows/publish-smoke-test-grpc-images.yml index 6222d4c35260..3ff902de7ce9 100644 --- a/.github/workflows/publish-smoke-test-grpc-images.yml +++ b/.github/workflows/publish-smoke-test-grpc-images.yml @@ -19,18 +19,5 @@ jobs: issue: name: Open issue on failure needs: publish - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/publish-smoke-test-play-images.yml b/.github/workflows/publish-smoke-test-play-images.yml index e20d4c34ccb5..2a57abd647d5 100644 --- a/.github/workflows/publish-smoke-test-play-images.yml +++ b/.github/workflows/publish-smoke-test-play-images.yml @@ -53,18 +53,5 @@ jobs: issue: name: Open issue on failure needs: [ publish, publish-java-15 ] - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/publish-smoke-test-quarkus-images.yml b/.github/workflows/publish-smoke-test-quarkus-images.yml index 2f2054569606..8607239a5bc6 100644 --- a/.github/workflows/publish-smoke-test-quarkus-images.yml +++ b/.github/workflows/publish-smoke-test-quarkus-images.yml @@ -21,18 +21,5 @@ jobs: issue: name: Open issue on failure needs: publish - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/publish-smoke-test-servlet-images.yml b/.github/workflows/publish-smoke-test-servlet-images.yml index c10fed264b63..ce269851bd70 100644 --- a/.github/workflows/publish-smoke-test-servlet-images.yml +++ b/.github/workflows/publish-smoke-test-servlet-images.yml @@ -74,18 +74,5 @@ jobs: issue: name: Open issue on failure needs: publish - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/publish-smoke-test-spring-boot-images.yml b/.github/workflows/publish-smoke-test-spring-boot-images.yml index 578beb20af80..4644aa96a20c 100644 --- a/.github/workflows/publish-smoke-test-spring-boot-images.yml +++ b/.github/workflows/publish-smoke-test-spring-boot-images.yml @@ -19,18 +19,5 @@ jobs: issue: name: Open issue on failure needs: publish - runs-on: ubuntu-latest - if: always() - steps: - # run this action to get workflow conclusion - # You can get conclusion by env (env.WORKFLOW_CONCLUSION) - - uses: technote-space/workflow-conclusion-action@v2.2 - - - uses: actions/checkout@v3 - - - uses: JasonEtco/create-an-issue@v2.6 - if: env.WORKFLOW_CONCLUSION == 'failure' # notify only if failure - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/templates/workflow-failed.md + if: failure() + uses: ./.github/workflows/reusable-create-issue-for-failure.yml diff --git a/.github/workflows/reusable-create-issue-for-failure.yml b/.github/workflows/reusable-create-issue-for-failure.yml new file mode 100644 index 000000000000..d6e374653b48 --- /dev/null +++ b/.github/workflows/reusable-create-issue-for-failure.yml @@ -0,0 +1,27 @@ +name: Reusable - Create issue for failure + +on: + workflow_call: + +jobs: + create-issue: + name: Create issue + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Create issue + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cat > body.txt << EOF + [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) failed. + + Please take a look and fix it ASAP. + EOF + + gh issue create --title "$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER failed" \ + --label bug \ + --label area:build \ + --label priority:p1 \ + --body-file body.txt