-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add first skeleton of the action
- Loading branch information
Showing
20 changed files
with
3,683 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool] | ||
[tool.commitizen] | ||
name = "cz_customize" | ||
version = "0.0.0" | ||
tag_format = "v$version" | ||
bump_message = "bump: release $current_version → $new_version [skip-ci]" | ||
update_changelog_on_bump = true | ||
version_files = [ | ||
"package.json:version", | ||
] | ||
|
||
[tool.commitizen.customize] | ||
schema_pattern = "(break|build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump|deps)(\\(\\S+\\))?!?:(\\s.*)" | ||
bump_pattern = "^(break|build|feat|fix|refactor|style|test|revert|deps|docs|ci|chore)" | ||
bump_map = {"break" = "MAJOR", "build" = "MINOR", "feat" = "MINOR", "revert" = "MINOR", "fix" = "PATCH", "refactor" = "PATCH", "style" = "PATCH", "test" = "PATCH", "ci" = "PATCH", "deps" = "PATCH", "chore" = "PATCH", "docs" = "PATCH"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.github/ | ||
.cz.toml | ||
.eslintrc.json | ||
.pre-commit-config.yaml | ||
.prettierignore | ||
.prettierrc.json | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": ["plugin:prettier/recommended"], | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"prettier/prettier": "error" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
|
||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "npm" | ||
directory: "." | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Description | ||
|
||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. | ||
List any dependencies that are required for this change. | ||
|
||
## Task Context | ||
|
||
### What is the current behavior? | ||
|
||
<!-- current functionality without PR --> | ||
|
||
### What is the new behavior? | ||
|
||
<!-- expected functionality with PR --> | ||
|
||
### Additional Context | ||
|
||
<!-- Add here any additional context you think is important. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Cleanup caches by a branch | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
cleanup: | ||
name: Cleanup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cleanup all caches for repo | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO=${{ github.repository }} | ||
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
# test: | ||
# name: Test | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Install NodeJS | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: "20" | ||
|
||
# - name: Install dependencies | ||
# run: npm install | ||
|
||
# - name: Execute tests | ||
# run: npm run test | ||
|
||
commit_lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3.3.0 | ||
with: | ||
token: "${{ secrets.ACCESS_TOKEN }}" | ||
fetch-depth: 0 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4.7.0 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install Commitizen | ||
run: pip install -U commitizen | ||
|
||
- name: Check commits | ||
run: cz check --rev-range origin/main..HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
GIT_USER_EMAIL: ${{ secrets.GIT_EMAIL }} | ||
GIT_USER_NAME: ${{ secrets.GIT_NAME }} | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
bump_version: | ||
if: "!startsWith(github.event.head_commit.message, 'bump:')" | ||
runs-on: ubuntu-latest | ||
name: "Bump version" | ||
outputs: | ||
version: ${{ steps.cz.outputs.version }} | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: "${{ secrets.ACCESS_TOKEN }}" | ||
ref: "main" | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4.7.0 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Config Git User | ||
run: | | ||
git config --local user.email "$GIT_USER_EMAIL" | ||
git config --local user.name "$GIT_USER_NAME" | ||
git config --local pull.ff only | ||
- id: cz | ||
name: Create bump and changelog | ||
run: | | ||
python -m pip install -U commitizen | ||
cz bump --yes | ||
export REV=`cz version --project` | ||
echo "version=\"v$REV\"" >> $GITHUB_OUTPUT | ||
- name: Push changes | ||
uses: ad-m/github-push-action@v0.6.0 | ||
with: | ||
github_token: ${{ secrets.ACCESS_TOKEN }} | ||
repository: "Drafteame/ejson-action" | ||
branch: "main" | ||
directory: . | ||
tags: true | ||
|
||
- name: Print Version | ||
run: echo "Bumped to version ${{ steps.cz.outputs.version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea/ | ||
.vscode/ | ||
|
||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: v8.50.0 | ||
hooks: | ||
- id: eslint | ||
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx | ||
types: [file] | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
|
||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: 3.10.0 | ||
hooks: | ||
- id: commitizen | ||
stages: [commit-msg] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore artifacts: | ||
build/ | ||
coverage/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM node:20 | ||
|
||
RUN mkdir -p /opt/ejson/keys | ||
|
||
COPY . /action | ||
WORKDIR /action | ||
|
||
RUN chmod +x ejson-1.4.1 | ||
|
||
RUN npm install --production | ||
|
||
ENTRYPOINT ["node", "/action/index.js"] |
Oops, something went wrong.