Merge pull request #244 from oke-py/refactor/sync-with-typescript-action
refactor: sync with typescript-action template
This commit is contained in:
@@ -1,16 +1,41 @@
|
||||
{
|
||||
"name": "npm-audit-action-dev",
|
||||
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
},
|
||||
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
|
||||
"postCreateCommand": "npm install",
|
||||
"customizations": {
|
||||
"codespaces": {
|
||||
"openFiles": [
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"EditorConfig.EditorConfig",
|
||||
"GitHub.copilot",
|
||||
"saoudrizwan.claude-dev"
|
||||
]
|
||||
"bierner.markdown-preview-github-styles",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"github.copilot",
|
||||
"github.copilot-chat",
|
||||
"github.vscode-github-actions",
|
||||
"github.vscode-pull-request-github",
|
||||
"me-dutour-mathieu.vscode-github-actions",
|
||||
"redhat.vscode-yaml",
|
||||
"rvest.vs-code-prettier-eslint",
|
||||
"saoudrizwan.claude-dev",
|
||||
"yzhang.markdown-all-in-one"
|
||||
],
|
||||
"settings": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnSave": true,
|
||||
"markdown.extension.list.indentationSize": "adaptive",
|
||||
"markdown.extension.italic.indicator": "_",
|
||||
"markdown.extension.orderedList.marker": "one"
|
||||
}
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {},
|
||||
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
dist/** -diff linguist-generated=true
|
||||
31
.github/dependabot.yml
vendored
31
.github/dependabot.yml
vendored
@@ -1,7 +1,30 @@
|
||||
version: 2
|
||||
updates:
|
||||
# Maintain dependencies for GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: "daily"
|
||||
interval: weekly
|
||||
groups:
|
||||
actions-minor:
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
ignore:
|
||||
- dependency-name: '@types/node'
|
||||
update-types:
|
||||
- 'version-update:semver-major'
|
||||
groups:
|
||||
npm-development:
|
||||
dependency-type: development
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
npm-production:
|
||||
dependency-type: production
|
||||
update-types:
|
||||
- patch
|
||||
|
||||
2
.github/release.yml
vendored
2
.github/release.yml
vendored
@@ -13,4 +13,4 @@ changelog:
|
||||
- enhancement
|
||||
- title: Other Changes
|
||||
labels:
|
||||
- "*"
|
||||
- '*'
|
||||
|
||||
72
.github/workflows/check-dist.yml
vendored
Normal file
72
.github/workflows/check-dist.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# In TypeScript actions, `dist/` is a special directory. When you reference
|
||||
# an action with the `uses:` property, `dist/index.js` is the code that will be
|
||||
# run. For this project, the `dist/index.js` file is transpiled from other
|
||||
# source files. This workflow ensures the `dist/` directory contains the
|
||||
# expected transpiled code.
|
||||
#
|
||||
# If this workflow is run from a feature branch, it will act as an additional CI
|
||||
# check and fail if the checked-in `dist/` directory does not match what is
|
||||
# expected from the build.
|
||||
name: Check Transpiled JavaScript
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-dist:
|
||||
name: Check dist/
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
id: install
|
||||
run: npm ci
|
||||
|
||||
- name: Build dist/ Directory
|
||||
id: build
|
||||
run: npm run bundle
|
||||
|
||||
# This will fail the workflow if the `dist/` directory is different than
|
||||
# expected.
|
||||
- name: Compare Directories
|
||||
id: diff
|
||||
run: |
|
||||
if [ ! -d dist/ ]; then
|
||||
echo "Expected dist/ directory does not exist. See status below:"
|
||||
ls -la ./
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build. See status below:"
|
||||
git diff --ignore-space-at-eol --text dist/
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If `dist/` was different than expected, upload the expected version as a
|
||||
# workflow artifact.
|
||||
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
||||
name: Upload Artifact
|
||||
id: upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
2
.github/workflows/daily.yml
vendored
2
.github/workflows/daily.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
name: npm audit
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
24
.github/workflows/dist.yml
vendored
24
.github/workflows/dist.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: "update dist/index.js"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
package:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
- name: format TypeScript code
|
||||
run: |
|
||||
npm run format
|
||||
- name: compile TypeScript code into dist/index.js
|
||||
run: |
|
||||
npm run package
|
||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "chore(build): automated change"
|
||||
40
.github/workflows/git-tag.yml
vendored
40
.github/workflows/git-tag.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: "git tag major version"
|
||||
name: 'git tag major version'
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
@@ -8,24 +8,24 @@ jobs:
|
||||
tag-major-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
- name: git tag
|
||||
run: |
|
||||
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
# Extract major version from release tag (e.g., v3.0.0 -> v3)
|
||||
MAJOR_VERSION=$(echo ${{ github.event.release.tag_name }} | grep -o "^v[0-9]*")
|
||||
echo "Tagging with major version: ${MAJOR_VERSION}"
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
- name: git tag
|
||||
run: |
|
||||
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
# Extract major version from release tag (e.g., v3.0.0 -> v3)
|
||||
MAJOR_VERSION=$(echo ${{ github.event.release.tag_name }} | grep -o "^v[0-9]*")
|
||||
echo "Tagging with major version: ${MAJOR_VERSION}"
|
||||
|
||||
# Delete the major version tag if it exists
|
||||
git push origin -d ${MAJOR_VERSION} || true
|
||||
# Delete the major version tag if it exists
|
||||
git push origin -d ${MAJOR_VERSION} || true
|
||||
|
||||
# Create and push the new major version tag
|
||||
git tag ${MAJOR_VERSION} ${GITHUB_SHA}
|
||||
git push origin ${MAJOR_VERSION}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Create and push the new major version tag
|
||||
git tag ${MAJOR_VERSION} ${GITHUB_SHA}
|
||||
git push origin ${MAJOR_VERSION}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
74
.github/workflows/licensed.yml
vendored
Normal file
74
.github/workflows/licensed.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# This workflow checks the statuses of cached dependencies used in this action
|
||||
# with the help of the Licensed tool. If any licenses are invalid or missing,
|
||||
# this workflow will fail. See: https://github.com/licensee/licensed
|
||||
|
||||
name: Licensed
|
||||
|
||||
on:
|
||||
# Uncomment the below lines to run this workflow on pull requests and pushes
|
||||
# to the default branch. This is useful for checking licenses before merging
|
||||
# changes into the default branch.
|
||||
# pull_request:
|
||||
# branches:
|
||||
# - main
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
licensed:
|
||||
name: Check Licenses
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
id: npm-ci
|
||||
run: npm ci
|
||||
|
||||
- name: Setup Ruby
|
||||
id: setup-ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ruby
|
||||
|
||||
- uses: licensee/setup-licensed@v1.3.2
|
||||
with:
|
||||
version: 4.x
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# If this is a workflow_dispatch event, update the cached licenses.
|
||||
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
name: Update Licenses
|
||||
id: update-licenses
|
||||
run: licensed cache
|
||||
|
||||
# Then, commit the updated licenses to the repository.
|
||||
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
name: Commit Licenses
|
||||
id: commit-licenses
|
||||
run: |
|
||||
git config --local user.email "licensed-ci@users.noreply.github.com"
|
||||
git config --local user.name "licensed-ci"
|
||||
git add .
|
||||
git commit -m "Auto-update license files"
|
||||
git push
|
||||
|
||||
# Last, check the status of the cached licenses.
|
||||
- name: Check Licenses
|
||||
id: check-licenses
|
||||
run: licensed status
|
||||
70
.github/workflows/package-version.yml
vendored
70
.github/workflows/package-version.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: "update package version"
|
||||
name: 'update package version'
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
@@ -9,41 +9,41 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.label.name == 'release minor' }}
|
||||
steps:
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
- name: increment minor version
|
||||
run: |
|
||||
npm version minor
|
||||
- name: git push
|
||||
run: |
|
||||
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
- name: increment minor version
|
||||
run: |
|
||||
npm version minor
|
||||
- name: git push
|
||||
run: |
|
||||
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
patch:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.label.name == 'release patch' }}
|
||||
steps:
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
- name: increment patch version
|
||||
run: |
|
||||
npm version patch
|
||||
- name: git push
|
||||
run: |
|
||||
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
- name: git config
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
- name: increment patch version
|
||||
run: |
|
||||
npm version patch
|
||||
- name: git push
|
||||
run: |
|
||||
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
90
.github/workflows/test.yml
vendored
90
.github/workflows/test.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: "build-test"
|
||||
name: 'build-test'
|
||||
on: # rebuild any PRs and main branch changes
|
||||
pull_request:
|
||||
push:
|
||||
@@ -10,20 +10,20 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
node: [20]
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Install dependencies and run tests
|
||||
run: |
|
||||
npm ci
|
||||
npm run test:coverage
|
||||
- uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Install dependencies and run tests
|
||||
run: |
|
||||
npm ci
|
||||
npm run test:coverage
|
||||
- uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build-on-windows:
|
||||
strategy:
|
||||
@@ -31,44 +31,44 @@ jobs:
|
||||
node: [20]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Install dependencies and run tests
|
||||
run: |
|
||||
npm ci
|
||||
npm run test
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Install dependencies and run tests
|
||||
run: |
|
||||
npm ci
|
||||
npm run test
|
||||
|
||||
test: # make sure the action works on a clean machine without building
|
||||
strategy:
|
||||
matrix:
|
||||
node: [20]
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Run npm audit action
|
||||
uses: ./
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue_title: npm audit run by test job
|
||||
create_issues: false
|
||||
production_flag: true
|
||||
- name: Run npm audit action in testdata workdir
|
||||
uses: ./
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
working_directory: __tests__/testdata/workdir/
|
||||
create_issues: false
|
||||
production_flag: true
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Run npm audit action
|
||||
uses: ./
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue_title: npm audit run by test job
|
||||
create_issues: false
|
||||
production_flag: true
|
||||
- name: Run npm audit action in testdata workdir
|
||||
uses: ./
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
working_directory: __tests__/testdata/workdir
|
||||
create_issues: false
|
||||
production_flag: true
|
||||
|
||||
# test-on-windows:
|
||||
# strategy:
|
||||
@@ -100,6 +100,6 @@ jobs:
|
||||
# uses: ./
|
||||
# with:
|
||||
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# working_directory: __tests__/testdata/workdir/
|
||||
# working_directory: __tests__/testdata/workdir
|
||||
# create_issues: false
|
||||
# production_flag: true
|
||||
|
||||
18
.licensed.yml
Normal file
18
.licensed.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
# See: https://github.com/licensee/licensed/blob/main/docs/configuration.md
|
||||
|
||||
sources:
|
||||
npm: true
|
||||
|
||||
allowed:
|
||||
- apache-2.0
|
||||
- bsd-2-clause
|
||||
- bsd-3-clause
|
||||
- isc
|
||||
- mit
|
||||
- cc0-1.0
|
||||
- other
|
||||
|
||||
ignored:
|
||||
npm:
|
||||
# Used by Rollup.js when building in GitHub Actions
|
||||
- '@rollup/rollup-linux-x64-gnu'
|
||||
24
.markdown-lint.yml
Normal file
24
.markdown-lint.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
# See: https://github.com/DavidAnson/markdownlint
|
||||
|
||||
# Unordered list style
|
||||
MD004:
|
||||
style: dash
|
||||
|
||||
# Disable line length for tables
|
||||
MD013:
|
||||
tables: false
|
||||
|
||||
# Ordered list item prefix
|
||||
MD029:
|
||||
style: one
|
||||
|
||||
# Spaces after list markers
|
||||
MD030:
|
||||
ul_single: 1
|
||||
ol_single: 1
|
||||
ul_multi: 1
|
||||
ol_multi: 1
|
||||
|
||||
# Code block style
|
||||
MD046:
|
||||
style: fenced
|
||||
1
.node-version
Normal file
1
.node-version
Normal file
@@ -0,0 +1 @@
|
||||
20.9.0
|
||||
14
.yaml-lint.yml
Normal file
14
.yaml-lint.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
# See: https://yamllint.readthedocs.io/en/stable/
|
||||
|
||||
rules:
|
||||
document-end: disable
|
||||
document-start:
|
||||
level: warning
|
||||
present: false
|
||||
line-length:
|
||||
level: warning
|
||||
max: 80
|
||||
allow-non-breakable-words: true
|
||||
allow-non-breakable-inline-mappings: true
|
||||
ignore:
|
||||
- .licenses/
|
||||
93
dist/index.js
generated
vendored
93
dist/index.js
generated
vendored
@@ -1,34 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var require$$0 = require('os');
|
||||
var require$$0$1 = require('crypto');
|
||||
var require$$1 = require('fs');
|
||||
var require$$1$5 = require('path');
|
||||
var require$$2$1 = require('http');
|
||||
var require$$3$1 = require('https');
|
||||
var require$$0$5 = require('net');
|
||||
var require$$1$1 = require('tls');
|
||||
var require$$4$1 = require('events');
|
||||
var require$$0$3 = require('assert');
|
||||
var require$$0$2 = require('util');
|
||||
var require$$0$4 = require('stream');
|
||||
var require$$7 = require('buffer');
|
||||
var require$$8 = require('querystring');
|
||||
var require$$14 = require('stream/web');
|
||||
var require$$0$7 = require('node:stream');
|
||||
var require$$1$2 = require('node:util');
|
||||
var require$$0$6 = require('node:events');
|
||||
var require$$0$8 = require('worker_threads');
|
||||
var require$$2$2 = require('perf_hooks');
|
||||
var require$$5 = require('util/types');
|
||||
var require$$4$2 = require('async_hooks');
|
||||
var require$$1$3 = require('console');
|
||||
var require$$1$4 = require('url');
|
||||
var require$$3$2 = require('zlib');
|
||||
var require$$6 = require('string_decoder');
|
||||
var require$$0$9 = require('diagnostics_channel');
|
||||
var require$$2$3 = require('child_process');
|
||||
var require$$6$1 = require('timers');
|
||||
import require$$0 from 'os';
|
||||
import require$$0$1 from 'crypto';
|
||||
import require$$1 from 'fs';
|
||||
import require$$1$5 from 'path';
|
||||
import require$$2$1 from 'http';
|
||||
import require$$3$1 from 'https';
|
||||
import require$$0$5 from 'net';
|
||||
import require$$1$1 from 'tls';
|
||||
import require$$4$1 from 'events';
|
||||
import require$$0$3 from 'assert';
|
||||
import require$$0$2 from 'util';
|
||||
import require$$0$4 from 'stream';
|
||||
import require$$7 from 'buffer';
|
||||
import require$$8 from 'querystring';
|
||||
import require$$14 from 'stream/web';
|
||||
import require$$0$7 from 'node:stream';
|
||||
import require$$1$2 from 'node:util';
|
||||
import require$$0$6 from 'node:events';
|
||||
import require$$0$8 from 'worker_threads';
|
||||
import require$$2$2 from 'perf_hooks';
|
||||
import require$$5 from 'util/types';
|
||||
import require$$4$2 from 'async_hooks';
|
||||
import require$$1$3 from 'console';
|
||||
import require$$1$4 from 'url';
|
||||
import require$$3$2 from 'zlib';
|
||||
import require$$6 from 'string_decoder';
|
||||
import require$$0$9 from 'diagnostics_channel';
|
||||
import require$$2$3, { spawnSync } from 'child_process';
|
||||
import require$$6$1 from 'timers';
|
||||
|
||||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||
|
||||
@@ -34463,10 +34461,8 @@ function stripAnsi(string) {
|
||||
|
||||
const SPAWN_PROCESS_BUFFER_SIZE = 10485760; // 10MiB
|
||||
class Audit {
|
||||
constructor() {
|
||||
this.stdout = '';
|
||||
this.status = null;
|
||||
}
|
||||
stdout = '';
|
||||
status = null;
|
||||
run(auditLevel, productionFlag, jsonFlag) {
|
||||
const auditOptions = ['audit', '--audit-level', auditLevel];
|
||||
const isWindowsEnvironment = process.platform === 'win32';
|
||||
@@ -34477,7 +34473,7 @@ class Audit {
|
||||
if (jsonFlag === 'true') {
|
||||
auditOptions.push('--json');
|
||||
}
|
||||
const result = require$$2$3.spawnSync(cmd, auditOptions, {
|
||||
const result = spawnSync(cmd, auditOptions, {
|
||||
encoding: 'utf-8',
|
||||
maxBuffer: SPAWN_PROCESS_BUFFER_SIZE
|
||||
});
|
||||
@@ -34549,10 +34545,24 @@ async function run() {
|
||||
// move to working directory
|
||||
const workingDirectory = coreExports.getInput('working_directory');
|
||||
if (workingDirectory) {
|
||||
if (!isValid(workingDirectory)) {
|
||||
// Remove trailing slash if present
|
||||
const normalizedWorkingDirectory = workingDirectory.endsWith('/')
|
||||
? workingDirectory.slice(0, -1)
|
||||
: workingDirectory;
|
||||
if (!isValid(normalizedWorkingDirectory)) {
|
||||
throw new Error('Invalid input: working_directory');
|
||||
}
|
||||
process.chdir(workingDirectory);
|
||||
try {
|
||||
// Try to change directory
|
||||
process.chdir(normalizedWorkingDirectory);
|
||||
coreExports.info(`Successfully changed directory to: ${normalizedWorkingDirectory}`);
|
||||
}
|
||||
catch (error) {
|
||||
// If changing directory fails, log the error but continue
|
||||
coreExports.warning(`Failed to change directory to: ${normalizedWorkingDirectory}`);
|
||||
coreExports.warning(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
||||
coreExports.warning('Continuing with current directory');
|
||||
}
|
||||
}
|
||||
coreExports.info(`Current working directory: ${process.cwd()}`);
|
||||
// get audit-level
|
||||
@@ -34633,5 +34643,10 @@ async function run() {
|
||||
}
|
||||
run();
|
||||
|
||||
exports.run = run;
|
||||
/**
|
||||
* The entrypoint for the action. This file simply imports and runs the action's
|
||||
* main logic.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
run();
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
dist/package.json
generated
vendored
3
dist/package.json
generated
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
1
dist/sourcemap-register.cjs
generated
vendored
1
dist/sourcemap-register.cjs
generated
vendored
File diff suppressed because one or more lines are too long
@@ -12,6 +12,7 @@
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"bundle": "npm run format && npm run package",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
@@ -58,4 +59,4 @@
|
||||
"vite": "^6.3.4",
|
||||
"vitest": "^3.1.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
// See: https://rollupjs.org/introduction/
|
||||
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import nodeResolve from '@rollup/plugin-node-resolve'
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
|
||||
const config = {
|
||||
input: 'src/main.ts',
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
esModule: true,
|
||||
file: 'dist/index.js',
|
||||
format: 'cjs',
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
typescript()
|
||||
]
|
||||
};
|
||||
plugins: [typescript(), nodeResolve({ preferBuiltins: true }), commonjs()]
|
||||
}
|
||||
|
||||
export default config;
|
||||
export default config
|
||||
|
||||
8
src/index.ts
Normal file
8
src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The entrypoint for the action. This file simply imports and runs the action's
|
||||
* main logic.
|
||||
*/
|
||||
import { run } from './main.js'
|
||||
|
||||
/* istanbul ignore next */
|
||||
run()
|
||||
25
src/main.ts
25
src/main.ts
@@ -12,10 +12,31 @@ export async function run(): Promise<void> {
|
||||
// move to working directory
|
||||
const workingDirectory = core.getInput('working_directory')
|
||||
if (workingDirectory) {
|
||||
if (!workdir.isValid(workingDirectory)) {
|
||||
// Remove trailing slash if present
|
||||
const normalizedWorkingDirectory = workingDirectory.endsWith('/')
|
||||
? workingDirectory.slice(0, -1)
|
||||
: workingDirectory
|
||||
|
||||
if (!workdir.isValid(normalizedWorkingDirectory)) {
|
||||
throw new Error('Invalid input: working_directory')
|
||||
}
|
||||
process.chdir(workingDirectory)
|
||||
|
||||
try {
|
||||
// Try to change directory
|
||||
process.chdir(normalizedWorkingDirectory)
|
||||
core.info(
|
||||
`Successfully changed directory to: ${normalizedWorkingDirectory}`
|
||||
)
|
||||
} catch (error) {
|
||||
// If changing directory fails, log the error but continue
|
||||
core.warning(
|
||||
`Failed to change directory to: ${normalizedWorkingDirectory}`
|
||||
)
|
||||
core.warning(
|
||||
`Error: ${error instanceof Error ? error.message : String(error)}`
|
||||
)
|
||||
core.warning('Continuing with current directory')
|
||||
}
|
||||
}
|
||||
core.info(`Current working directory: ${process.cwd()}`)
|
||||
|
||||
|
||||
22
tsconfig.base.json
Normal file
22
tsconfig.base.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": ["ES2022"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"newLine": "lf",
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": false,
|
||||
"pretty": true,
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "ES2022"
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,11 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020' or 'ESNEXT'. */
|
||||
"module": "NodeNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"*": ["src/*"]
|
||||
}
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/*.test.ts",
|
||||
"vitest.config.ts"
|
||||
]
|
||||
"exclude": ["__fixtures__", "__tests__", "coverage", "dist", "node_modules"],
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user