Skip to content

Commit 154b0ff

Browse files
committed
feat: Add GitHub Actions CI, linting, and project setup
This commit introduces a comprehensive CI setup for the project, along with essential linting and configuration files. Key changes include: - **GitHub Actions Workflows:** - `ci.yml`: Configures a complete continuous integration pipeline including TypeScript tests, action testing, and build steps. - `check-dist.yml`: Adds a workflow to ensure the `dist/` directory contains the expected transpiled code. - `codeql-analysis.yml`: Integrates CodeQL for static analysis. - `licensed.yml`: Sets up dependency license checking using the Licensed tool. - `linter.yml`: Utilizes Super-linter for comprehensive codebase linting. - **Configuration Files:** - `.env.example`: Provides an example environment file. - `.eslinlint.yml`, `.markdown-lint.yml`, `.prettierignore`, `.prettierrc.yml`, `.yaml-lint.yml`: Standard configuration files for ESLint, markdownlint, Prettier, and yamllint, ensuring code consistency. - `.vscode/launch.json`, `.vscode/mcp.json`, `.vscode/settings.json`: VS Code configuration for debugging and workspace settings. - `.licensed.yml`, `.node-version`: Configuration for the Licensed tool and Node.js version. - `actionlint.yml`: Configuration for Actionlint. - `rollup.config.ts`: Rollup configuration for bundling. - `tsconfig.base.json`, `tsconfig.eslint.json`, `tsconfig.json`: TypeScript configuration files for base settings, ESLint, and the main project. - **Codebase Structuring:** - `.gitignore`: Updated to ignore built artifacts and local environment files. - Test files (`__tests__`) refactored for consistency. - `action.yml`: Updated with refined descriptions and defaults. These changes establish a robust foundation for code quality, automated testing, and streamlined development workflows.
1 parent 52b099b commit 154b0ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+10823
-5208
lines changed

.env.example

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# dotenv-linter:off IncorrectDelimiter
2+
3+
# Do not commit your actual .env file to Git! This may contain secrets or other
4+
# private information.
5+
6+
# Enable/disable step debug logging (default: `false`). For local debugging, it
7+
# may be useful to set it to `true`.
8+
ACTIONS_STEP_DEBUG=true
9+
10+
# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive).
11+
# Hyphens should not be converted to underscores!
12+
INPUT_MILLISECONDS=2400
13+
14+
# GitHub Actions default environment variables. These are set for every run of a
15+
# workflow and can be used in your actions. Setting the value here will override
16+
# any value set by the local-action tool.
17+
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
18+
19+
# CI="true"
20+
# GITHUB_ACTION=""
21+
# GITHUB_ACTION_PATH=""
22+
# GITHUB_ACTION_REPOSITORY=""
23+
# GITHUB_ACTIONS=""
24+
# GITHUB_ACTOR=""
25+
# GITHUB_ACTOR_ID=""
26+
# GITHUB_API_URL=""
27+
# GITHUB_BASE_REF=""
28+
# GITHUB_ENV=""
29+
# GITHUB_EVENT_NAME=""
30+
# GITHUB_EVENT_PATH=""
31+
# GITHUB_GRAPHQL_URL=""
32+
# GITHUB_HEAD_REF=""
33+
# GITHUB_JOB=""
34+
# GITHUB_OUTPUT=""
35+
# GITHUB_PATH=""
36+
# GITHUB_REF=""
37+
# GITHUB_REF_NAME=""
38+
# GITHUB_REF_PROTECTED=""
39+
# GITHUB_REF_TYPE=""
40+
# GITHUB_REPOSITORY=""
41+
# GITHUB_REPOSITORY_ID=""
42+
# GITHUB_REPOSITORY_OWNER=""
43+
# GITHUB_REPOSITORY_OWNER_ID=""
44+
# GITHUB_RETENTION_DAYS=""
45+
# GITHUB_RUN_ATTEMPT=""
46+
# GITHUB_RUN_ID=""
47+
# GITHUB_RUN_NUMBER=""
48+
# GITHUB_SERVER_URL=""
49+
# GITHUB_SHA=""
50+
# GITHUB_STEP_SUMMARY=""
51+
# GITHUB_TRIGGERING_ACTOR=""
52+
# GITHUB_WORKFLOW=""
53+
# GITHUB_WORKFLOW_REF=""
54+
# GITHUB_WORKFLOW_SHA=""
55+
# GITHUB_WORKSPACE=""
56+
# RUNNER_ARCH=""
57+
# RUNNER_DEBUG=""
58+
# RUNNER_NAME=""
59+
# RUNNER_OS=""
60+
# RUNNER_TEMP=""
61+
# RUNNER_TOOL_CACHE=""

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
dist/** -diff linguist-generated=true
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/codeql/codeql-config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: JavaScript CodeQL Configuration
2+
3+
paths-ignore:
4+
- node_modules
5+
- dist

.github/dependabot.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ updates:
77
groups:
88
github-actions:
99
patterns:
10-
- "actions/*"
10+
- 'actions/*'
11+
actions-minor:
12+
update-types:
13+
- minor
14+
- patch
1115

1216
- package-ecosystem: npm
1317
directory: /
@@ -16,16 +20,16 @@ updates:
1620
groups:
1721
types:
1822
patterns:
19-
- "@types/*"
23+
- '@types/*'
2024
actions:
2125
patterns:
22-
- "@actions/*"
26+
- '@actions/*'
2327
linters:
2428
patterns:
25-
- "eslint*"
26-
- "prettier"
27-
- "@typescript-eslint/*"
29+
- 'eslint*'
30+
- 'prettier'
31+
- '@typescript-eslint/*'
2832
test-runners:
2933
patterns:
30-
- "jest"
31-
- "*-jest"
34+
- 'jest'
35+
- '*-jest'

.github/workflows/check-dist.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# In TypeScript actions, `dist/` is a special directory. When you reference
2+
# an action with the `uses:` property, `dist/index.js` is the code that will be
3+
# run. For this project, the `dist/index.js` file is transpiled from other
4+
# source files. This workflow ensures the `dist/` directory contains the
5+
# expected transpiled code.
6+
#
7+
# If this workflow is run from a feature branch, it will act as an additional CI
8+
# check and fail if the checked-in `dist/` directory does not match what is
9+
# expected from the build.
10+
name: Check Transpiled JavaScript
11+
12+
on:
13+
pull_request:
14+
branches:
15+
- main
16+
push:
17+
branches:
18+
- main
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
check-dist:
25+
name: Check dist/
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout
30+
id: checkout
31+
uses: actions/checkout@v5
32+
33+
- name: Setup Node.js
34+
id: setup-node
35+
uses: actions/setup-node@v5
36+
with:
37+
node-version-file: .node-version
38+
cache: npm
39+
40+
- name: Install Dependencies
41+
id: install
42+
run: npm ci
43+
44+
- name: Build dist/ Directory
45+
id: build
46+
run: npm run bundle
47+
48+
# This will fail the workflow if the `dist/` directory is different than
49+
# expected.
50+
- name: Compare Directories
51+
id: diff
52+
run: |
53+
if [ ! -d dist/ ]; then
54+
echo "Expected dist/ directory does not exist. See status below:"
55+
ls -la ./
56+
exit 1
57+
fi
58+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
59+
echo "Detected uncommitted changes after build. See status below:"
60+
git diff --ignore-space-at-eol --text dist/
61+
exit 1
62+
fi
63+
64+
# If `dist/` was different than expected, upload the expected version as a
65+
# workflow artifact.
66+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
67+
name: Upload Artifact
68+
id: upload
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: dist
72+
path: dist/

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test-typescript:
16+
name: TypeScript Tests
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
id: checkout
22+
uses: actions/checkout@v5
23+
24+
- name: Setup Node.js
25+
id: setup-node
26+
uses: actions/setup-node@v5
27+
with:
28+
node-version-file: .node-version
29+
cache: npm
30+
31+
- name: Install Dependencies
32+
id: npm-ci
33+
run: npm ci
34+
35+
- name: Check Format
36+
id: npm-format-check
37+
run: npm run format:check
38+
39+
- name: Lint
40+
id: npm-lint
41+
run: npm run lint
42+
43+
- name: Test
44+
id: npm-ci-test
45+
run: npm run ci-test
46+
47+
test-action:
48+
name: GitHub Actions Test
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Checkout
53+
id: checkout
54+
uses: actions/checkout@v5
55+
56+
- name: Test Local Action
57+
id: test-action
58+
uses: ./
59+
with:
60+
milliseconds: 2000
61+
62+
- name: Print Output
63+
id: output
64+
run: echo "${{ steps.test-action.outputs.time }}"
65+
66+
build:
67+
runs-on: ubuntu-latest
68+
69+
steps:
70+
- uses: actions/checkout@v5
71+
72+
- name: Setup Node.js
73+
id: setup-node
74+
uses: actions/setup-node@v5
75+
with:
76+
node-version-file: .node-version
77+
cache: npm
78+
79+
- name: Install Dependencies
80+
id: npm-ci
81+
run: npm ci
82+
83+
- run: npm run all
84+
85+
- uses: stefanzweifel/git-auto-commit-action@v7
86+
if: github.event_name != 'pull_request'
87+
with:
88+
commit_message: Add prepared script
89+
commit_options: '--no-verify --signoff'
90+
file_pattern: dist/
91+
commit_user_name: github-actions
92+
commit_user_email: github-actions[bot]@users.noreply.github.com
93+
commit_author: hw <github-actions[bot]@users.noreply.github.com>
94+
push_options: ''
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CodeQL
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '31 7 * * 3'
12+
13+
permissions:
14+
actions: read
15+
checks: write
16+
contents: read
17+
security-events: write
18+
19+
jobs:
20+
analyze:
21+
name: Analyze
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language:
28+
- typescript
29+
30+
steps:
31+
- name: Checkout
32+
id: checkout
33+
uses: actions/checkout@v5
34+
35+
- name: Initialize CodeQL
36+
id: initialize
37+
uses: github/codeql-action/init@v3
38+
with:
39+
config-file: .github/codeql/codeql-config.yml
40+
languages: ${{ matrix.language }}
41+
source-root: src
42+
43+
- name: Autobuild
44+
id: autobuild
45+
uses: github/codeql-action/autobuild@v3
46+
47+
- name: Perform CodeQL Analysis
48+
id: analyze
49+
uses: github/codeql-action/analyze@v3

.github/workflows/codeql.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)