diff --git a/.github/workflows/report_clang_format.yml b/.github/workflows/report_clang_format.yml new file mode 100644 index 000000000..11500bdcc --- /dev/null +++ b/.github/workflows/report_clang_format.yml @@ -0,0 +1,31 @@ +name: Report clang format + +# Runs after the Check clang format workflow (check_clang_format.yml) to +# post a helpful comment to the PR if the check failed. +# +# N.B.: Per https://github.community/t/workflow-runs-not-starting-after-previous-workflow-completes/128345/8 +# only the version of this workflow on the master (default) branch +# will be run, regardless of what branch is targetted by the PR being +# checked by check_clang_format.yml. +# +# N.B.: Runs with a read-write repo token. Do not check out the +# submitted branch! +on: + workflow_run: + workflows: ["Check clang format"] + types: + - completed + +on: [pull_request] + +jobs: + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - uses: actions/github-script@v5 + with: + script: | + // Not sure yet how to find out which PR triggered the run, so + // dump the whole context object to try to find useful information. + console.log('%o', context);