Skip to content

Commit

Permalink
chore: adds a check for properly formatted files (google#5624)
Browse files Browse the repository at this point in the history
* chore: add check for clang format

* chore: updates clang format script
  • Loading branch information
alschmiedt authored Oct 25, 2021
1 parent 52c0427 commit 8a89e08
Show file tree
Hide file tree
Showing 5 changed files with 1,014 additions and 7 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/check_clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test-clang-format
on: [pull_request]

jobs:
clang-formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: DoozyX/clang-format-lint-action@v0.12
with:
source: 'core'
extensions: 'js'
clangFormatVersion: 12
style: Google

- uses: actions/github-script@v5
if: failure()
with:
script: |
console.log(context.issue.number)
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'It looks like some of your files have not been formatted properly. Please run `npm run format`.'
})
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
buildAdvancedCompilationTest: buildTasks.advancedCompilationTest,
checkin: gulp.parallel(buildTasks.checkinBuilt, typings.checkinTypings),
checkinBuilt: buildTasks.checkinBuilt,
clangFormat: buildTasks.format,
clean: gulp.parallel(buildTasks.cleanBuildDir, packageTasks.cleanReleaseDir),
cleanBuildDir: buildTasks.cleanBuildDir,
cleanReleaseDir: packageTasks.cleanReleaseDir,
Expand Down
Loading

0 comments on commit 8a89e08

Please sign in to comment.