aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
diff options
context:
space:
mode:
authorsunadoi <[email protected]>2022-10-10 05:11:25 +0900
committerGitHub <[email protected]>2022-10-09 22:11:25 +0200
commitf934792db4c3c1b44550b79cee893aa545164c59 (patch)
treecf4b32e8a1574d79cf005b781f0181e6fbfd5dd9 /.github/workflows/ci.yml
parent13dac4f4c6879933ceba045e1235161ed3c6b4f2 (diff)
downloadfaker-f934792db4c3c1b44550b79cee893aa545164c59.tar.xz
faker-f934792db4c3c1b44550b79cee893aa545164c59.zip
infra: add CI step to detect generate script diffs (#1405)
Diffstat (limited to '.github/workflows/ci.yml')
-rw-r--r--.github/workflows/ci.yml53
1 files changed, 53 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a05df2ec..61750b54 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -203,3 +203,56 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
+
+ check-code-generation:
+ runs-on: ubuntu-latest
+ name: 'Check Code Generation: node-18, ubuntu-latest'
+ permissions:
+ pull-requests: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Install pnpm
+ uses: pnpm/[email protected]
+ with:
+ version: 7
+
+ - name: Set node version to 18
+ uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ cache: 'pnpm'
+
+ - name: Install deps
+ run: pnpm install
+ env:
+ CYPRESS_INSTALL_BINARY: 0
+
+ - name: Generate code
+ run: |
+ pnpm run generate:locales
+ pnpm run generate:api-docs
+
+ - name: Check diff
+ id: diff
+ run: |
+ git add .
+ git diff --cached --exit-code
+ continue-on-error: true
+
+ - name: Transpile ts
+ run: pnpm exec tsc .github/workflows/commentCodeGeneration.ts --outDir .github/workflows
+
+ - name: Comment
+ uses: actions/github-script@v6
+ with:
+ script: |
+ const script = require('${{ github.workspace }}/.github/workflows/commentCodeGeneration.js')
+ await script(github, context, ${{ steps.diff.outcome == 'success' }})
+
+ - name: Status
+ if: ${{ steps.diff.outcome == 'failure' }}
+ run: exit 1