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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
root = true

[*.{js, ts}]
[*.js]
charset = utf-8
indent_style = space
indent_size = 2
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

78 changes: 0 additions & 78 deletions .eslintrc.json

This file was deleted.

17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Set default behavior to automatically normalize line endings
* text=auto

# JavaScript files should always use LF line endings
*.js text eol=lf
*.json text eol=lf

# Markdown files
*.md text eol=lf

# Config files
.editorconfig text eol=lf
.gitignore text eol=lf
.prettierignore text eol=lf

# YAML files
*.yml text eol=lf
264 changes: 125 additions & 139 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,139 +1,125 @@
name: On pull request

on:
pull_request:
branches:
- main

permissions: write-all

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 20.x

steps:
- name: Checkouting code...
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: NPM install
run: npm install

- name: NPM test
run: npm run test

build:

runs-on: ubuntu-latest
needs: test

strategy:
matrix:
node-version:
- 20.x

steps:
- name: Checkouting code...
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: NPM install
run: npm install

- name: NPM build
run: npm run build

- name: NPM format
run: npm run format

- name: NPM format check
run: npm run format-check

- name: Lint
run: npm run lint

- name: Pack
run: npm run pack

- name: Uploading build artifact...
uses: actions/upload-artifact@v4
with:
name: build
path: dist/*.js

commit_and_push:

runs-on: ubuntu-latest
name: Commit and push build if needed
needs: build

steps:
- name: Checkouting code...
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Downloading build artifact....
uses: actions/download-artifact@v4
with:
name: build
path: dist/

- name: Auto commiting changes...
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatically builded and updated
file_pattern: dist/*.js
skip_fetch: true
skip_checkout: true

dependabot:
needs:
- build
- commit_and_push
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
# Checking the actor will prevent your Action run failing on non-Dependabot
# PRs but also ensures that it only does work for Dependabot PRs.
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
# This first step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Here the PR gets approved.
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Finally, this sets the PR to allow auto-merging for patch and minor
# updates if all checks pass
- name: Enable auto-merge for Dependabot PRs
# if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: On pull request

on:
pull_request:
branches:
- main

permissions: write-all

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 20.x

steps:
- name: Checkouting code...
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: NPM install
run: npm install

- name: NPM test
run: npm run test

build:

runs-on: ubuntu-latest
needs: test

steps:
- name: Checkouting code...
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: NPM install
run: npm install

- name: NPM format
run: npm run format

- name: NPM format check
run: npm run format-check

- name: Lint
run: npm run lint

- name: Pack
run: npm run pack

- name: Uploading build artifact...
uses: actions/upload-artifact@v4
with:
name: build
path: dist/*.*

commit_and_push:

runs-on: ubuntu-latest
name: Commit and push build if needed
needs: build

steps:
- name: Checkouting code...
uses: actions/checkout@v4

- name: Downloading build artifact....
uses: actions/download-artifact@v4
with:
name: build
path: dist/

- name: Auto commiting changes...
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatically builded and updated
file_pattern: dist/*.js dist/*.json
skip_fetch: true
skip_checkout: true

dependabot:
needs:
- build
- commit_and_push
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
# Checking the actor will prevent your Action run failing on non-Dependabot
# PRs but also ensures that it only does work for Dependabot PRs.
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
# This first step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Here the PR gets approved.
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Finally, this sets the PR to allow auto-merging for patch and minor
# updates if all checks pass
- name: Enable auto-merge for Dependabot PRs
# if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,4 @@ Thumbs.db
__tests__/runner/*
lib/**/*

.idea/
package-lock.json
.idea/
6 changes: 3 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
Loading