-
-
Notifications
You must be signed in to change notification settings - Fork 0
ci: split CI workflow into separate jobs with reusable actions and build artifacts #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
LayZeeDK
merged 42 commits into
main
from
copilot/fix-1aed1b67-1164-4160-a8f4-4a8b6243b29c
Oct 4, 2025
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
93c68a0
feat: add matrix strategy for testing across OS/arch/Node versions
Copilot 8033bfc
refactor: split CI into separate jobs with specified runners
Copilot 39fed80
refactor: extract reusable composite actions
Copilot 8d1b7bb
fix: checkout repository before using composite actions
Copilot e1916b7
feat: use build artifacts from build job in e2e tests
Copilot 47d82d3
fix: restore task dependency and use --exclude-task-dependencies in CI
Copilot d8bc4e3
fix: increase artifact retention to 7 days
Copilot 0bf750c
feat: add --output-style=static to Nx commands
Copilot 6603c7c
ci(copilot): use composite actions in setup steps workflow
LayZeeDK 0cbf949
ci(github): merge 2 conditional steps to 1
LayZeeDK 4aa9ce5
ci(copilot): set setup steps workflow-level permissions
LayZeeDK 1d0fd06
ci(github): make `post-status-check` inputs required
LayZeeDK 2e390b4
ci(github): use dynamic event name in status descriptions for `post-s…
LayZeeDK 60b0609
chore: add `@nx/node`
LayZeeDK 19a2f95
chore(nx): support GitHub Actions projects
LayZeeDK fb3d167
feat: generate `github-actions-post-status-check` application
LayZeeDK 315a904
refactor: convert post-status-check to JavaScript action with node24 …
Copilot aefec05
fix: update action.yml to point to source main.js instead of dist
Copilot 73d88ec
fix: bundle action dependencies into dist file
Copilot 38633f7
refactor: build action in CI instead of committing bundled file
Copilot 8c2b202
fix: make job-status input optional for pending state
Copilot cd529b5
refactor: remove build step, use source directly with workspace deps
Copilot fb1c52a
feat: restore build target for type-checking
Copilot 23fcd47
ci: accept GitHub token as input in post-status-check action
LayZeeDK 8c9a24b
Format action index file and fix test
Copilot 4d0c6fd
Fix e2e job artifact download error
Copilot 1b0e05d
Conditionally use --exclude-task-dependencies when artifacts are avai…
Copilot b7676ff
Simplify e2e conditional to single line with ternary expression
Copilot 70fb636
Fix n/prefer-node-protocol lint errors by using node: protocol
Copilot 2d8a26f
ci: pass commit SHA as input to post-status-check action
Copilot e4ffd76
ci: make sha input required with no fallback
Copilot ea7a683
fix: address code review feedback for jest globals, mock settings, an…
Copilot 98f755f
feat(ci): build all projects and always skip e2e task dependencies
Copilot 5d90658
fix(ci): use kebab-case for exclude-task-dependencies flag
Copilot e88b2a0
chore: remove languageOptions from project-level eslint config
Copilot b66670b
chore: revert workspace config and remove jest globals from post-stat…
Copilot fb10ab4
test: move `post-status-check` test suite to use correct TypeScript c…
LayZeeDK f5542f5
chore: add `globals` for ESLint configuration
LayZeeDK 049a171
chore(eslint): set Jest globals in test suites
LayZeeDK cc24b60
ci: add expected values to `job-status` description
LayZeeDK b6c8676
ci: use Linux arm64 runner for `build` and `lint` jobs
LayZeeDK 5db32f4
style: format CI workflow
LayZeeDK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Post status check | ||
| description: Post pending or outcome status check for workflow_dispatch events | ||
|
|
||
| inputs: | ||
| state: | ||
| description: Status state (pending or outcome) | ||
| required: true | ||
| context: | ||
| description: Status context name | ||
| required: true | ||
| job-status: | ||
| description: 'Job status (for outcome checks; expected values: success, failure, cancelled, etc.)' | ||
| required: false | ||
| workflow-file: | ||
| description: Workflow file name to use in the status description (e.g. ci.yml) | ||
| required: true | ||
| sha: | ||
| description: Commit SHA to post status to | ||
| required: true | ||
|
|
||
| runs: | ||
| using: node24 | ||
| main: src/main.js | ||
LayZeeDK marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| const baseConfig = require('../../../eslint.config.js'); | ||
|
|
||
| module.exports = [...baseConfig]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| module.exports = { | ||
| displayName: 'github-actions-post-status-check', | ||
| preset: '../../../jest.preset.js', | ||
| testEnvironment: 'node', | ||
| moduleFileExtensions: ['js', 'jsx'], | ||
| coverageDirectory: '../../../coverage/.github/actions/post-status-check', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "@nxworker/github-actions-post-status-check", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "commonjs", | ||
| "main": "src/main.js", | ||
| "dependencies": { | ||
| "@actions/core": "^1.11.1", | ||
| "@actions/github": "^6.0.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| { | ||
| "name": "github-actions-post-status-check", | ||
| "$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
| "sourceRoot": ".github/actions/post-status-check/src", | ||
| "projectType": "application", | ||
| "tags": [], | ||
| "targets": { | ||
| "build": { | ||
| "executor": "@nx/esbuild:esbuild", | ||
| "outputs": ["{options.outputPath}"], | ||
| "defaultConfiguration": "production", | ||
| "options": { | ||
| "platform": "node", | ||
| "outputPath": "dist/.github/actions/post-status-check", | ||
| "format": ["cjs"], | ||
| "bundle": false, | ||
| "main": ".github/actions/post-status-check/src/main.js", | ||
| "tsConfig": ".github/actions/post-status-check/tsconfig.app.json", | ||
| "assets": [".github/actions/post-status-check/src/assets"], | ||
| "generatePackageJson": true, | ||
| "esbuildOptions": { | ||
| "sourcemap": true, | ||
| "outExtension": { | ||
| ".js": ".js" | ||
| } | ||
| } | ||
| }, | ||
| "configurations": { | ||
| "development": {}, | ||
| "production": { | ||
| "esbuildOptions": { | ||
| "sourcemap": false, | ||
| "outExtension": { | ||
| ".js": ".js" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "test": { | ||
| "executor": "@nx/jest:jest", | ||
| "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], | ||
| "options": { | ||
| "jestConfig": ".github/actions/post-status-check/jest.config.js" | ||
| } | ||
| } | ||
| } | ||
| } |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| const core = require('@actions/core'); | ||
| const github = require('@actions/github'); | ||
|
|
||
| async function run() { | ||
| try { | ||
| // Get inputs | ||
| const state = core.getInput('state', { required: true }); | ||
| const context = core.getInput('context', { required: true }); | ||
| const jobStatus = core.getInput('job-status', { required: false }); | ||
| const workflowFile = core.getInput('workflow-file', { required: true }); | ||
| const sha = core.getInput('sha', { required: true }); | ||
|
|
||
| // Only run for workflow_dispatch events | ||
| if (github.context.eventName !== 'workflow_dispatch') { | ||
| core.info('Skipping status check - not a workflow_dispatch event'); | ||
| return; | ||
| } | ||
|
|
||
| // Get GitHub token from input, context, or environment (in order of preference) | ||
| let token = core.getInput('token', { required: false }); | ||
| if (!token) { | ||
| token = github.context.token; | ||
| } | ||
| if (!token) { | ||
| token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN; | ||
| } | ||
| if (!token) { | ||
| core.setFailed( | ||
| 'GitHub token not found. Please provide it as an action input, or ensure it is available in the context or environment.', | ||
| ); | ||
| return; | ||
| } | ||
|
|
||
| const octokit = github.getOctokit(token); | ||
| const { owner, repo } = github.context.repo; | ||
| const eventName = github.context.eventName; | ||
| const runId = github.context.runId; | ||
|
|
||
| let statusState; | ||
| let description; | ||
|
|
||
| if (state === 'pending') { | ||
| statusState = 'pending'; | ||
| description = `${workflowFile} (${eventName}) in progress`; | ||
| } else if (state === 'outcome') { | ||
| if (jobStatus === 'success') { | ||
| statusState = 'success'; | ||
| description = `${workflowFile} (${eventName}) succeeded`; | ||
| } else { | ||
| statusState = 'failure'; | ||
| description = `${workflowFile} (${eventName}) failed`; | ||
| } | ||
| } else { | ||
| core.setFailed(`Invalid state: ${state}. Must be 'pending' or 'outcome'`); | ||
| return; | ||
| } | ||
|
|
||
| // Post status to GitHub | ||
| await octokit.rest.repos.createCommitStatus({ | ||
| owner, | ||
| repo, | ||
| sha, | ||
| state: statusState, | ||
| context, | ||
| description, | ||
| target_url: `https://github.com/${owner}/${repo}/actions/runs/${runId}`, | ||
| }); | ||
|
|
||
| core.info(`Posted ${statusState} status for context: ${context}`); | ||
|
|
||
| // Exit with error if job failed (for outcome state) | ||
| if (state === 'outcome' && jobStatus !== 'success') { | ||
| core.setFailed(`Job status is ${jobStatus}`); | ||
| } | ||
| } catch (error) { | ||
| core.setFailed(error.message); | ||
| } | ||
| } | ||
|
|
||
| // Only run if not in test environment | ||
| if (process.env.NODE_ENV !== 'test') { | ||
| run(); | ||
| } | ||
|
|
||
| module.exports = { run }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.