diff --git a/.github/workflows/manage-prs.yml b/.github/workflows/manage-prs.yml index 02d2ad6d..bd383d14 100644 --- a/.github/workflows/manage-prs.yml +++ b/.github/workflows/manage-prs.yml @@ -93,6 +93,7 @@ jobs: outputs: type: ${{ steps.parse-request.outputs.type }} + error: ${{ steps.parse-request.outputs.error }} arduinoLintLibraryManagerSetting: ${{ steps.parse-request.outputs.arduinoLintLibraryManagerSetting }} submissions: ${{ steps.parse-request.outputs.submissions }} index-entry: ${{ steps.parse-request.outputs.index-entry }} @@ -133,6 +134,7 @@ jobs: # Due to limitations of the GitHub Actions workflow system, dedicated outputs must be created for use in # certain workflow fields. echo "::set-output name=type::$(echo "$REQUEST" | jq -r -c '.type')" + echo "::set-output name=error::$(echo "$REQUEST" | jq -r -c '.error')" echo "::set-output name=arduinoLintLibraryManagerSetting::$(echo "$REQUEST" | jq -r -c '.arduinoLintLibraryManagerSetting')" echo "::set-output name=submissions::$(echo "$REQUEST" | jq -c '.submissions')" echo "::set-output name=index-entry::$(echo "$REQUEST" | jq -r -c '.indexEntry')" @@ -156,6 +158,34 @@ jobs: labels: | - ${{ needs.parse.outputs.type }} + parse-fail: + needs: + - parse + if: needs.parse.outputs.error != '' + + runs-on: ubuntu-latest + steps: + - name: Comment on error detected while parsing PR + uses: octokit/request-action@v2.x + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + route: POST /repos/{owner}/{repo}/issues/{issue_number}/comments + owner: ${{ github.repository_owner }} + repo: ${{ github.event.repository.name }} + issue_number: ${{ github.event.pull_request.number }}${{ github.event.issue.number }} + body: | + | + Hi @${{ github.actor }} + A problem was found with your pull request: + + ${{ env.ERROR_MESSAGE_PREFIX }}${{ needs.parse.outputs.error }} + + Please resolve this error. The checks will automatically run again once that is done. + + More information: + https://github.com/${{ github.repository }}/blob/main/README.md#if-the-problem-is-with-the-pull-request + check-submissions: name: Check ${{ matrix.submission.submissionURL }} needs: @@ -473,7 +503,10 @@ jobs: not-submission: needs: - parse - if: needs.parse.outputs.type != 'submission' # These request types can't be automatically approved. + # These request types can't be automatically approved. + if: > + needs.parse.outputs.type != 'submission' && + needs.parse.outputs.type != 'invalid' runs-on: ubuntu-latest steps: - name: Comment on required review @@ -497,6 +530,7 @@ jobs: unexpected-fail: needs: # Run after all other jobs + - parse-fail - merge-fail - check-submissions-fail - label @@ -548,12 +582,14 @@ jobs: request-review: needs: + - parse-fail - merge-fail - not-submission - unexpected-fail if: > always() && ( + needs.parse-fail.result != 'skipped' || needs.merge-fail.result != 'skipped' || needs.not-submission.result != 'skipped' || needs.unexpected-fail.result != 'skipped'