Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
env: {
node: true,
es2021: true,
'jest/globals': true,
commonjs: true
},
extends: [
'eslint:recommended'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
plugins: [
'jest'
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
rules: {
'indent': ['error', 2],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
'semi': ['error', 'always'],
'no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error'
}
};
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: tuesday
open-pull-requests-limit: 10
32 changes: 32 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
[pull_request]

name: Check

jobs:
check:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run tests
run: |
npm ci
npm test

conventional-commits:
name: Semantic Pull Request
runs-on: ubuntu-latest
steps:
- name: validate
uses: actions/github-script@v7
with:
script: |
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
const regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)/g;
const pr = context.payload.pull_request;
const title = pr.title;
if (title.match(regex) == null) {
throw `PR title "${title}"" does not match conventional commits from https://www.conventionalcommits.org/en/v1.0.0/`
}
66 changes: 66 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '0 12 * * 1' # Runs at 12:00 UTC on Mondays

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
# Override automatic language detection by specifying the list of languages
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# 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

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
27 changes: 27 additions & 0 deletions .github/workflows/dependabot-autoapprove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Dependabot auto-approve

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
auto-approve:
name: Auto-approve Dependabot PRs
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Approve PR if not already approved
run: |
gh pr checkout "${{ github.event.pull_request.number }}"
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then
gh pr review "${{ github.event.pull_request.number }}" --approve
else
echo "PR already approved"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Package

on:
pull_request:

jobs:
build:
name: Package distribution file
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Init a git repo
uses: actions/checkout@v4
- name: Checkout PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Package
run: |
npm ci
npm test
npm run build
- name: Commit to PR
if: github.actor == 'dependabot[bot]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git add dist/
git commit -m "chore: Update dist" || echo "No changes to commit"
git push
- name: Check git diff
if: github.actor != 'dependabot[bot]'
run: |
git diff --exit-code dist/index.js
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
.DS_Store
coverage
repolinter
deploy-lambda.yml
Config
43 changes: 43 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
queue_rules:
- name: default
merge_conditions:
- status-success=Run Unit Tests
- status-success=Semantic Pull Request
- status-success=Analyze (javascript)
merge_method: squash

pull_request_rules:
- name: Automatically merge on CI success and review approval
conditions:
- base~=master|integ-tests
- "#approved-reviews-by>=1"
- approved-reviews-by= # @your-org/your-team-name
- -approved-reviews-by~=author
- status-success=Run Unit Tests
- status-success=Semantic Pull Request
- status-success=Analyze (javascript)
- label!=work-in-progress
- -title~=(WIP|wip)
- -merged
- -closed
- author!=dependabot[bot]
actions:
queue:
name: default

- name: Automatically approve and merge Dependabot PRs
conditions:
- base=master
- author=dependabot[bot]
- status-success=Run Unit Tests
- status-success=Semantic Pull Request
- status-success=Analyze (javascript)
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge)
- -merged
- -closed
actions:
review:
type: APPROVE
queue:
name: default
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changelog

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.

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.
opensource-codeofconduct@amazon.com with any additional questions or comments.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ If you discover a potential security issue in this project we ask that you notif

## Licensing

See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading
Loading