diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d733df..bc0f8e7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,21 @@ jobs: docker push ${{ env.WEBSITE_IMAGE }} docker push ${{ env.NGINX_IMAGE }} + - name: create an issue + if: ${{ failure() }} + run: | + echo $(cat error) + ERROR=$(cat error) + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/issues \ + --header 'authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}' \ + --header 'content-type: application/json' \ + --data '{ + "title": "Automated issue for a commit: ${{ github.job }}", + "body": "## Description\n\nThis issue was automatically created by the GitHub Action.\n\nThe Job **`${{github.job}}`** of the workflow run **`${{github.run_number}}`** failed with the following error:\n\n`'"$ERROR"'`\n\n## Run details\n\n- Workflow: `${{ github.workflow }}`\n\n- The actor of the run: `${{ github.triggering_actor }}`\n\n- The commit hash was: _${{ github.sha }}_\n\nKindly fix it in the shortest time possible.\n\nThank you." + }' \ + --fail + checking-secrets: name: Checking secrets runs-on: ubuntu-latest