Skip to content

Commit 79929a4

Browse files
author
wuychloe@amazon.com chloe1818
committed
Add initial project files
1 parent 09820c8 commit 79929a4

34 files changed

+15785
-24
lines changed

.eslintrc.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
es2021: true,
5+
'jest/globals': true,
6+
commonjs: true
7+
},
8+
extends: [
9+
'eslint:recommended'
10+
],
11+
globals: {
12+
Atomics: 'readonly',
13+
SharedArrayBuffer: 'readonly'
14+
},
15+
plugins: [
16+
'jest'
17+
],
18+
parserOptions: {
19+
ecmaVersion: 'latest',
20+
sourceType: 'module'
21+
},
22+
rules: {
23+
'indent': ['error', 2],
24+
'linebreak-style': ['error', 'unix'],
25+
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
26+
'semi': ['error', 'always'],
27+
'no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
28+
'jest/no-disabled-tests': 'warn',
29+
'jest/no-focused-tests': 'error',
30+
'jest/no-identical-title': 'error',
31+
'jest/prefer-to-have-length': 'warn',
32+
'jest/valid-expect': 'error'
33+
}
34+
};

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*Issue #, if available:*
2+
3+
*Description of changes:*
4+
5+
6+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
day: tuesday
8+
open-pull-requests-limit: 10

.github/workflows/check.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
[pull_request]
3+
4+
name: Check
5+
6+
jobs:
7+
check:
8+
name: Run Unit Tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Run tests
14+
run: |
15+
npm ci
16+
npm test
17+
18+
conventional-commits:
19+
name: Semantic Pull Request
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: validate
23+
uses: actions/github-script@v7
24+
with:
25+
script: |
26+
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
27+
const regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)/g;
28+
const pr = context.payload.pull_request;
29+
const title = pr.title;
30+
if (title.match(regex) == null) {
31+
throw `PR title "${title}"" does not match conventional commits from https://www.conventionalcommits.org/en/v1.0.0/`
32+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
name: "CodeQL"
7+
8+
on:
9+
push:
10+
branches: [ main ]
11+
pull_request:
12+
# The branches below must be a subset of the branches above
13+
branches: [ main ]
14+
schedule:
15+
- cron: '0 12 * * 1' # Runs at 12:00 UTC on Mondays
16+
17+
jobs:
18+
analyze:
19+
name: Analyze
20+
runs-on: ubuntu-latest
21+
permissions:
22+
actions: read
23+
contents: read
24+
security-events: write
25+
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
# Override automatic language detection by specifying the list of languages
30+
language: [ 'javascript' ]
31+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
32+
# Learn more:
33+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v2
42+
with:
43+
languages: ${{ matrix.language }}
44+
# If you wish to specify custom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
48+
49+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
50+
# If this step fails, then you should remove it and run the build manually (see below)
51+
- name: Autobuild
52+
uses: github/codeql-action/autobuild@v2
53+
54+
# ℹ️ Command-line programs to run using the OS shell.
55+
# 📚 https://git.io/JvXDl
56+
57+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
58+
# and modify them (or add more) to build your code if your project
59+
# uses a compiled language
60+
61+
#- run: |
62+
# make bootstrap
63+
# make release
64+
65+
- name: Perform CodeQL Analysis
66+
uses: github/codeql-action/analyze@v2
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Dependabot auto-approve
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
auto-approve:
9+
name: Auto-approve Dependabot PRs
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
permissions:
13+
pull-requests: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Approve PR if not already approved
19+
run: |
20+
gh pr checkout "${{ github.event.pull_request.number }}"
21+
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
22+
gh pr review "${{ github.event.pull_request.number }}" --approve
23+
else
24+
echo "PR already approved"
25+
fi
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/package.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Package
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
name: Package distribution file
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
steps:
13+
- name: Init a git repo
14+
uses: actions/checkout@v4
15+
- name: Checkout PR
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
run: gh pr checkout ${{ github.event.pull_request.number }}
19+
- name: Package
20+
run: |
21+
npm ci
22+
npm test
23+
npm run build
24+
- name: Commit to PR
25+
if: github.actor == 'dependabot[bot]'
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
git config --global user.name "GitHub Actions"
30+
git add dist/
31+
git commit -m "chore: Update dist" || echo "No changes to commit"
32+
git push
33+
- name: Check git diff
34+
if: github.actor != 'dependabot[bot]'
35+
run: |
36+
git diff --exit-code dist/index.js

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
.DS_Store
4+
coverage
5+
repolinter
6+
deploy-lambda.yml
7+
Config

.mergify.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
queue_rules:
2+
- name: default
3+
merge_conditions:
4+
- status-success=Run Unit Tests
5+
- status-success=Semantic Pull Request
6+
- status-success=Analyze (javascript)
7+
merge_method: squash
8+
9+
pull_request_rules:
10+
- name: Automatically merge on CI success and review approval
11+
conditions:
12+
- base~=master|integ-tests
13+
- "#approved-reviews-by>=1"
14+
- approved-reviews-by= # @your-org/your-team-name
15+
- -approved-reviews-by~=author
16+
- status-success=Run Unit Tests
17+
- status-success=Semantic Pull Request
18+
- status-success=Analyze (javascript)
19+
- label!=work-in-progress
20+
- -title~=(WIP|wip)
21+
- -merged
22+
- -closed
23+
- author!=dependabot[bot]
24+
actions:
25+
queue:
26+
name: default
27+
28+
- name: Automatically approve and merge Dependabot PRs
29+
conditions:
30+
- base=master
31+
- author=dependabot[bot]
32+
- status-success=Run Unit Tests
33+
- status-success=Semantic Pull Request
34+
- status-success=Analyze (javascript)
35+
- -title~=(WIP|wip)
36+
- -label~=(blocked|do-not-merge)
37+
- -merged
38+
- -closed
39+
actions:
40+
review:
41+
type: APPROVE
42+
queue:
43+
name: default

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4+

0 commit comments

Comments
 (0)