Skip to content

Commit acb2d1c

Browse files
Merge pull request #5 from Workiva/bootstrap
CID-12231: Create Semgrep custom action
2 parents 0742190 + cbabbd6 commit acb2d1c

29 files changed

Lines changed: 39874 additions & 3 deletions

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# See: https://eslint.org/docs/latest/use/configure/ignore
2+
coverage/
3+
dist/
4+
lib/
5+
node_modules/

.eslintrc.json

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

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# See: https://git-scm.com/docs/gitattributes
2+
#
3+
# Used in conjunction with .github/workflows/check-dist.yml.
4+
* text=auto eol=lf
5+
6+
dist/** -diff linguist-generated=true

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# See: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
2+
* @Workiva/cid-maintainers

.github/dependabot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
version: 2
3+
registries:
4+
artifactory:
5+
type: npm-registry
6+
url: https://workivaeast.jfrog.io/workivaeast/api/npm-prod/
7+
username: '${{secrets.NPM_REGISTRY_WORKIVAEAST_JFROG_IO_WORKIVAEAST_API_NPM_PROD_USERNAME}}'
8+
password: '${{secrets.NPM_REGISTRY_WORKIVAEAST_JFROG_IO_WORKIVAEAST_API_NPM_PROD_PASSWORD}}'
9+
updates:
10+
# Maintain dependencies for GitHub Actions
11+
- package-ecosystem: 'github-actions'
12+
directory: '/'
13+
schedule:
14+
interval: 'weekly'
15+
day: 'monday'
16+
time: '10:00'
17+
timezone: 'America/Chicago'
18+
groups:
19+
gha-dependencies:
20+
patterns:
21+
- 'actions/'
22+
- 'workiva/gha-*'
23+
# Maintain dependencies for NPM
24+
- package-ecosystem: 'npm'
25+
directory: '/'
26+
registries:
27+
- artifactory
28+
schedule:
29+
interval: 'weekly'
30+
day: 'monday'
31+
time: '10:00'
32+
timezone: 'America/Chicago'
33+
groups:
34+
all:
35+
patterns:
36+
- '*'

.github/linters/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// See: https://www.typescriptlang.org/tsconfig/
2+
//
3+
// This TSConfig file is used for linting. The TSConfig file in the root
4+
// directory is used for specifying the TypeScript project.
5+
{
6+
"$schema": "https://json.schemastore.org/tsconfig",
7+
"extends": "../../tsconfig.json",
8+
"compilerOptions": {
9+
"noEmit": true
10+
},
11+
"include": ["../../__tests__/**/*", "../../src/**/*"],
12+
"exclude": ["../../coverage", "../../dist", "../../node_modules", "*.json"]
13+
}

.github/workflows/check-dist.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# In TypeScript actions, `dist/` is a special directory. When you reference an
2+
# action with the `uses` syntax, `dist/index.js` is the code that will be run
3+
# (see action.yml).
4+
#
5+
# For this project, the `dist/index.js` file is transpiled from other source
6+
# files. This workflow ensures the `dist/` directory contains the expected
7+
# transpiled code.
8+
name: Check dist/
9+
10+
on: [push, pull_request]
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
jobs:
17+
check-dist:
18+
runs-on: [self-hosted, xs]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: 'Set up Node'
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version-file: .node-version
25+
cache: npm
26+
- name: 'Install dependencies'
27+
run: npm ci
28+
- name: 'Build dist/ directory'
29+
run: npm run bundle
30+
# The following will fail if the `dist/` directory differs from the
31+
# committed `dist/` directory.
32+
- name: 'Compare expected and actual dist/ directories'
33+
id: diff
34+
run: |
35+
if [ ! -d dist/ ]; then
36+
echo "Expected dist/ directory does not exist. See status below:"
37+
ls -la ./
38+
exit 1
39+
fi
40+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
41+
echo "Detected uncommitted changes after build. See diff below:"
42+
git diff --ignore-space-at-eol --text dist/
43+
exit 1
44+
fi

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
id-token: write
8+
9+
jobs:
10+
test-typescript:
11+
runs-on: [self-hosted, small]
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: 'Set up Node'
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version-file: .node-version
18+
cache: npm
19+
- name: 'Install dependencies'
20+
run: npm ci
21+
- name: 'Check formatting'
22+
run: npm run format:check
23+
- name: 'Lint'
24+
run: npm run lint
25+
- name: 'Test'
26+
run: npm run test
27+
- uses: Workiva/gha-upload-test-reports@v2.0.7
28+
# test-action:
29+
# runs-on: [self-hosted, dev-small]
30+
# steps:
31+
# - uses: actions/checkout@v4
32+
# - name: 'Test local action'
33+
# uses: ./

.github/workflows/codeql.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: ['*']
6+
pull_request:
7+
branches: ['*']
8+
schedule:
9+
# Runs at 07:00, only on Monday.
10+
- cron: '0 9 * * 0'
11+
12+
permissions:
13+
actions: read
14+
checks: write
15+
contents: read
16+
security-events: write
17+
18+
jobs:
19+
codeql:
20+
runs-on: [self-hosted, small]
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language:
25+
- javascript-typescript
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: 'Set up CodeQL'
29+
uses: github/codeql-action/init@v3
30+
with:
31+
languages: ${{ matrix.language }}
32+
source-root: src
33+
- name: 'Attempt to automatically build code'
34+
uses: github/codeql-action/autobuild@v3
35+
- name: 'Perform CodeQL analysis'
36+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)