Skip to content

Commit f53d367

Browse files
committed
Initial Version
0 parents  commit f53d367

34 files changed

+35466
-0
lines changed

.devcontainer/devcontainer.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "GitHub Actions (TypeScript)",
3+
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
4+
"postCreateCommand": "npm install",
5+
"customizations": {
6+
"codespaces": {
7+
"openFiles": ["README.md"]
8+
},
9+
"vscode": {
10+
"extensions": [
11+
"bierner.markdown-preview-github-styles",
12+
"davidanson.vscode-markdownlint",
13+
"dbaeumer.vscode-eslint",
14+
"esbenp.prettier-vscode",
15+
"github.copilot",
16+
"github.copilot-chat",
17+
"github.vscode-github-actions",
18+
"github.vscode-pull-request-github",
19+
"me-dutour-mathieu.vscode-github-actions",
20+
"redhat.vscode-yaml",
21+
"rvest.vs-code-prettier-eslint",
22+
"yzhang.markdown-all-in-one"
23+
],
24+
"settings": {
25+
"editor.defaultFormatter": "esbenp.prettier-vscode",
26+
"editor.tabSize": 2,
27+
"editor.formatOnSave": true,
28+
"markdown.extension.list.indentationSize": "adaptive",
29+
"markdown.extension.italic.indicator": "_",
30+
"markdown.extension.orderedList.marker": "one"
31+
}
32+
}
33+
},
34+
"remoteEnv": {
35+
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
36+
},
37+
"features": {
38+
"ghcr.io/devcontainers/features/github-cli:1": {},
39+
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
40+
}
41+
}

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lib/
2+
dist/
3+
node_modules/
4+
coverage/

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/dependabot.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
actions-minor:
9+
update-types:
10+
- minor
11+
- patch
12+
13+
- package-ecosystem: npm
14+
directory: /
15+
schedule:
16+
interval: weekly
17+
groups:
18+
npm-development:
19+
dependency-type: development
20+
update-types:
21+
- minor
22+
- patch
23+
npm-production:
24+
dependency-type: production
25+
update-types:
26+
- patch

.github/linters/.eslintrc.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
env:
2+
node: true
3+
es6: true
4+
jest: true
5+
6+
globals:
7+
Atomics: readonly
8+
SharedArrayBuffer: readonly
9+
10+
ignorePatterns:
11+
- '!.*'
12+
- '**/node_modules/.*'
13+
- '**/dist/.*'
14+
- '**/coverage/.*'
15+
- '*.json'
16+
17+
parser: '@typescript-eslint/parser'
18+
19+
parserOptions:
20+
ecmaVersion: 2023
21+
sourceType: module
22+
project:
23+
- './.github/linters/tsconfig.json'
24+
- './tsconfig.json'
25+
26+
plugins:
27+
- jest
28+
- '@typescript-eslint'
29+
30+
extends:
31+
- eslint:recommended
32+
- plugin:@typescript-eslint/eslint-recommended
33+
- plugin:@typescript-eslint/recommended
34+
- plugin:github/recommended
35+
- plugin:jest/recommended
36+
37+
rules:
38+
{
39+
'camelcase': 'off',
40+
'eslint-comments/no-use': 'off',
41+
'eslint-comments/no-unused-disable': 'off',
42+
'i18n-text/no-en': 'off',
43+
'import/no-namespace': 'off',
44+
'no-console': 'off',
45+
'no-unused-vars': 'off',
46+
'prettier/prettier': 'error',
47+
'semi': 'off',
48+
'@typescript-eslint/array-type': 'error',
49+
'@typescript-eslint/await-thenable': 'error',
50+
'@typescript-eslint/ban-ts-comment': 'error',
51+
'@typescript-eslint/consistent-type-assertions': 'error',
52+
'@typescript-eslint/explicit-member-accessibility':
53+
['error', { 'accessibility': 'no-public' }],
54+
'@typescript-eslint/explicit-function-return-type':
55+
['error', { 'allowExpressions': true }],
56+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
57+
'@typescript-eslint/no-array-constructor': 'error',
58+
'@typescript-eslint/no-empty-interface': 'error',
59+
'@typescript-eslint/no-explicit-any': 'error',
60+
'@typescript-eslint/no-extraneous-class': 'error',
61+
'@typescript-eslint/no-for-in-array': 'error',
62+
'@typescript-eslint/no-inferrable-types': 'error',
63+
'@typescript-eslint/no-misused-new': 'error',
64+
'@typescript-eslint/no-namespace': 'error',
65+
'@typescript-eslint/no-non-null-assertion': 'warn',
66+
'@typescript-eslint/no-require-imports': 'error',
67+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
68+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
69+
'@typescript-eslint/no-unused-vars': 'error',
70+
'@typescript-eslint/no-useless-constructor': 'error',
71+
'@typescript-eslint/no-var-requires': 'error',
72+
'@typescript-eslint/prefer-for-of': 'warn',
73+
'@typescript-eslint/prefer-function-type': 'warn',
74+
'@typescript-eslint/prefer-includes': 'error',
75+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
76+
'@typescript-eslint/promise-function-async': 'error',
77+
'@typescript-eslint/require-array-sort-compare': 'error',
78+
'@typescript-eslint/restrict-plus-operands': 'error',
79+
'@typescript-eslint/semi': ['error', 'never'],
80+
'@typescript-eslint/space-before-function-paren': 'off',
81+
'@typescript-eslint/type-annotation-spacing': 'error',
82+
'@typescript-eslint/unbound-method': 'error'
83+
}

.github/linters/.markdown-lint.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Unordered list style
2+
MD004:
3+
style: dash
4+
5+
# Ordered list item prefix
6+
MD029:
7+
style: one
8+
9+
# Spaces after list markers
10+
MD030:
11+
ul_single: 1
12+
ol_single: 1
13+
ul_multi: 1
14+
ol_multi: 1
15+
16+
# Code block style
17+
MD046:
18+
style: fenced

.github/linters/.yaml-lint.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rules:
2+
document-end: disable
3+
document-start:
4+
level: warning
5+
present: false
6+
line-length:
7+
level: warning
8+
max: 80
9+
allow-non-breakable-words: true
10+
allow-non-breakable-inline-mappings: true

.github/linters/tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": true
6+
},
7+
"include": ["../../__tests__/**/*", "../../src/**/*"],
8+
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
9+
}

.github/workflows/check-dist.yml

+72
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@v4
32+
33+
- name: Setup Node.js
34+
id: setup-node
35+
uses: actions/setup-node@v4
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

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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@v4
23+
24+
- name: Setup Node.js
25+
id: setup-node
26+
uses: actions/setup-node@v4
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@v4
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 }}"

.github/workflows/codeql-analysis.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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@v4
34+
35+
- name: Initialize CodeQL
36+
id: initialize
37+
uses: github/codeql-action/init@v3
38+
with:
39+
languages: ${{ matrix.language }}
40+
source-root: src
41+
42+
- name: Autobuild
43+
id: autobuild
44+
uses: github/codeql-action/autobuild@v3
45+
46+
- name: Perform CodeQL Analysis
47+
id: analyze
48+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)