From bf3ee481ec40c5fedd19857bf76aefbc32c83241 Mon Sep 17 00:00:00 2001 From: sunadoi <57832553+sunadoi@users.noreply.github.com> Date: Mon, 10 Oct 2022 15:50:25 +0900 Subject: infra: move the check-code-generation job to pr.yml (#1419) --- .github/workflows/ci.yml | 53 ----------------------------------------- .github/workflows/pr.yml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61750b54..a05df2ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -203,56 +203,3 @@ 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/action-setup@v2.2.2 - 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 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..a4e52d9b --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,61 @@ +name: PR + +on: + pull_request: + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + 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/action-setup@v2.2.2 + 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 -- cgit v1.2.3