From d549e2d0c743e1d0c77aa19c15766e855f2b1ddc Mon Sep 17 00:00:00 2001 From: kevinbarz Date: Tue, 3 Mar 2026 17:23:47 +0100 Subject: [PATCH] feat: add pre-build-command input to PR and deploy workflows Allows projects with codegen (e.g. GraphQL) to run setup commands before linting and building. Runs before lint in PR workflow and before build in deploy workflow, so generated files are available for TypeScript-aware tools like fork-ts-checker-webpack-plugin. --- .github/workflows/frontend-deploy-workflow.yml | 10 ++++++++++ .github/workflows/frontend-pr-workflow.yml | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index a4327b7..3689aec 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -45,6 +45,10 @@ on: default: '["self-hosted", "ci-e2e"]' # Build configuration + pre-build-command: + description: 'Command to run before build (e.g., GraphQL codegen)' + type: string + default: '' build-command: description: 'Production build command' type: string @@ -290,6 +294,12 @@ jobs: jarvis-branch: ${{ inputs.jarvis-branch }} GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Run pre-build command + if: inputs.pre-build-command != '' + run: ${{ inputs.pre-build-command }} + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Clean dist directory run: ${{ inputs.clean-command }} diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index bdf343f..f0c55c4 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -58,6 +58,10 @@ on: default: '[self-hosted, ci-e2e]' # Build configuration + pre-build-command: + description: 'Command to run before linting/build (e.g., GraphQL codegen)' + type: string + default: '' build-command: description: 'Build command to run' type: string @@ -292,6 +296,15 @@ jobs: jarvis-branch: ${{ inputs.jarvis-branch }} GH_TOKEN: ${{ secrets.GH_TOKEN }} + # Runs before linting AND build so that generated files (e.g. GraphQL + # codegen) are available for both TypeScript-aware lint rules and + # build tools like fork-ts-checker-webpack-plugin. + - name: Run pre-build command + if: inputs.pre-build-command != '' + run: ${{ inputs.pre-build-command }} + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Run linting if: inputs.run-linting run: ${{ inputs.lint-command }}