Skip to content

Commit

Permalink
fix: Create separate report_clang_format workflow in master branch
Browse files Browse the repository at this point in the history
The initial version of this workflow just uses `console.log` to report
the context of the `context` object.  It is hoped that there will
be enough information in this context to identify the PR to comment on,
without the `check_clang_format` workflow having to upload a
'build artefact' of some kind - see example of what I hoe to avoid
starting at `ReceivePR.yml` here:

https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

A follow-up PR will (if possible) add the code to create comments
when `check_clang_format` fails.

Part of google#5659.
  • Loading branch information
cpcallen committed Nov 2, 2021
1 parent 8515827 commit ac67aa3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/report_clang_format.yml
Original file line number Diff line number Diff line change
@@ -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.saobby.my.eu.orgmunity/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);

0 comments on commit ac67aa3

Please sign in to comment.