feat: Node 20, projen

This commit is contained in:
Derek Kershner 2023-12-30 19:18:19 -08:00
parent 324f5343f2
commit e99a592bfe
54 changed files with 42276 additions and 24475 deletions

162
.eslintrc.json generated
View File

@ -7,16 +7,24 @@
"root": true,
"plugins": [
"@typescript-eslint",
"import"
"import",
"jest",
"sonarjs"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.dev.json"
"project": "./tsconfig.json"
},
"extends": [
"plugin:import/typescript"
"plugin:import/typescript",
"plugin:prettier/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:sonarjs/recommended"
],
"settings": {
"import/parsers": {
@ -28,7 +36,7 @@
"import/resolver": {
"node": {},
"typescript": {
"project": "./tsconfig.dev.json",
"project": "./tsconfig.json",
"alwaysTryTypes": true
}
}
@ -43,102 +51,6 @@
"!projenrc/**/*.ts"
],
"rules": {
"indent": [
"off"
],
"@typescript-eslint/indent": [
"error",
2
],
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"no-multi-spaces": [
"error",
{
"ignoreEOLComments": false
}
],
"array-bracket-spacing": [
"error",
"never"
],
"array-bracket-newline": [
"error",
"consistent"
],
"object-curly-spacing": [
"error",
"always"
],
"object-curly-newline": [
"error",
{
"multiline": true,
"consistent": true
}
],
"object-property-newline": [
"error",
{
"allowAllPropertiesOnSameLine": true
}
],
"keyword-spacing": [
"error"
],
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"space-before-blocks": [
"error"
],
"curly": [
"error",
"multi-line",
"consistent"
],
"@typescript-eslint/member-delimiter-style": [
"error"
],
"semi": [
"error",
"always"
],
"max-len": [
"error",
{
"code": 150,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreComments": true,
"ignoreRegExpLiterals": true
}
],
"quote-props": [
"error",
"consistent-as-needed"
],
"@typescript-eslint/no-require-imports": [
"error"
],
@ -148,6 +60,10 @@
"devDependencies": [
"**/test/**",
"**/build-tools/**",
"src/**/__tests__/**/*",
"src/**/__mocks__/**/*",
"src/**/*.test.ts",
"src/**/*.spec.ts",
".projenrc.ts",
"projenrc/**/*.ts"
],
@ -155,9 +71,7 @@
"peerDependencies": true
}
],
"import/no-unresolved": [
"error"
],
"import/no-unresolved": "off",
"import/order": [
"warn",
{
@ -219,9 +133,51 @@
"method"
]
}
],
"no-console": [
"warn",
{
"allow": [
"debug",
"info",
"warn",
"error"
]
}
],
"import/namespace": "off",
"sonarjs/no-redundant-jump": "off",
"sonarjs/no-small-switch": "warn",
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
"allowExpressions": true,
"allowTypedFunctionExpressions": true,
"allowHigherOrderFunctions": true,
"allowDirectConstAssertionInArrowFunctions": true,
"allowConciseArrowFunctionExpressionsStartingWithVoid": true
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"ignoreRestSiblings": true
}
]
},
"overrides": [
{
"files": [
"*.js",
"*.jsx"
],
"rules": {
"import/no-unresolved": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-var-requires": "off"
}
},
{
"files": [
".projenrc.ts"

8
.gitattributes generated vendored
View File

@ -4,6 +4,7 @@
/.eslintrc.json linguist-generated
/.gitattributes linguist-generated
/.github/pull_request_template.md linguist-generated
/.github/workflows/auto-approve.yml linguist-generated
/.github/workflows/build.yml linguist-generated
/.github/workflows/pull-request-lint.yml linguist-generated
/.github/workflows/release.yml linguist-generated
@ -11,6 +12,9 @@
/.gitignore linguist-generated
/.mergify.yml linguist-generated
/.npmignore linguist-generated
/.npmrc linguist-generated
/.prettierignore linguist-generated
/.prettierrc.json linguist-generated
/.projen/** linguist-generated
/.projen/deps.json linguist-generated
/.projen/files.json linguist-generated
@ -19,6 +23,6 @@
/dist/** linguist-generated
/LICENSE linguist-generated
/package.json linguist-generated
/tsconfig.dev.json linguist-generated
/pnpm-lock.yaml linguist-generated
/tsconfig.json linguist-generated
/yarn.lock linguist-generated
/tsconfig.publish.json linguist-generated

21
.github/workflows/auto-approve.yml generated vendored Normal file
View File

@ -0,0 +1,21 @@
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
name: auto-approve
on:
pull_request_target:
types:
- labeled
- opened
- synchronize
- reopened
- ready_for_review
jobs:
approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: contains(github.event.pull_request.labels.*.name, 'auto-approve') && (github.event.pull_request.user.login == 'dkershner6')
steps:
- uses: hmarr/auto-approve-action@v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

10
.github/workflows/build.yml generated vendored
View File

@ -19,8 +19,16 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: "8"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.10.0
- name: Install dependencies
run: yarn install --check-files
run: pnpm i --no-frozen-lockfile
- name: build
run: npx projen build
- name: Find mutations

31
.github/workflows/release.yml generated vendored
View File

@ -24,8 +24,16 @@ jobs:
run: |-
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: "8"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.10.0
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
run: pnpm i --frozen-lockfile
- name: release
run: npx projen release
- name: Check for new commits
@ -41,6 +49,25 @@ jobs:
with:
name: build-artifact
path: dist
major-release:
needs: release_github
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: rickstaa/action-create-tag@v1
with:
force_push_tag: true
tag: v2
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: true
tag: v2
token: ${{ secrets.GITHUB_TOKEN }}
release_github:
name: Publish to GitHub Releases
needs: release
@ -51,7 +78,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.10.0
- name: Download build artifacts
uses: actions/download-artifact@v3
with:

10
.github/workflows/upgrade-main.yml generated vendored
View File

@ -18,8 +18,16 @@ jobs:
uses: actions/checkout@v3
with:
ref: main
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: "8"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.10.0
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
run: pnpm i --frozen-lockfile
- name: Upgrade dependencies
run: npx projen upgrade
- name: Find mutations

6
.gitignore generated vendored
View File

@ -4,6 +4,7 @@
!/.projen/deps.json
!/.projen/files.json
!/.github/workflows/pull-request-lint.yml
!/.github/workflows/auto-approve.yml
!/package.json
!/LICENSE
!/.npmignore
@ -39,9 +40,12 @@ junit.xml
!/.mergify.yml
!/.github/workflows/upgrade-main.yml
!/.github/pull_request_template.md
!/.prettierignore
!/.prettierrc.json
!/.npmrc
!/test/
!/tsconfig.publish.json
!/tsconfig.json
!/tsconfig.dev.json
!/src/
/lib
!/.eslintrc.json

2
.npmignore generated
View File

@ -8,7 +8,7 @@ permissions-backup.acl
/dist/version.txt
/.mergify.yml
/test/
/tsconfig.dev.json
/tsconfig.publish.json
/src/
!/lib/
!/lib/**/*.js

3
.npmrc generated Normal file
View File

@ -0,0 +1,3 @@
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
resolution-mode=highest

View File

@ -1,3 +0,0 @@
dist/
lib/
node_modules/

View File

@ -1,19 +0,0 @@
{
"plugins": ["jest", "@typescript-eslint", "github"],
"extends": ["plugin:github/recommended", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json",
"createDefaultProgram": true
},
"rules": {
"camelcase": "off"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}

View File

@ -1,16 +0,0 @@
name: "build-test"
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- master
- 'releases/*'
jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
npm ci
npm run all

99
.old/.gitignore vendored
View File

@ -1,99 +0,0 @@
# Dependency directory
node_modules
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# OS metadata
.DS_Store
Thumbs.db
# Ignore built ts files
__tests__/runner/*
lib/**/*

View File

@ -1,4 +0,0 @@
dist/
lib/
node_modules/
parseJsonSafely.test.ts

View File

@ -1,6 +0,0 @@
{
"printWidth": 80,
"tabWidth": 4,
"singleQuote": true,
"parser": "typescript"
}

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2018 GitHub, Inc. and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.

View File

@ -1,38 +0,0 @@
# webhook-action
GitHub Action that sends a POST request of any kind. This is a thin wrapper around Axios.post.
## Inputs
### `url`
**Required**: URL to send post request to.
### `data`
Optional: JSON string of data to pass into request. Default `"{}"`.
### `headers`
Optional: JSON string of headers to pass into request. Default `"{}"`.
### `params`
Optional: JSON string of query parameters to pass into request. Default `"{}"`.
## Example usage
```yaml
uses: dkershner6/post-api-call-action@v1
with:
url: ${{ secrets.API_URL }}
data: "{\"command\": \"publish\"}"
headers: "{\"Authorization\": \"Bearer ${{ secrets.API_KEY }}\"}"
params: "{\"content\": \"Test Content\"}"
```
## Contributing
Feel free to open issues or submit PRs.

View File

@ -1,25 +0,0 @@
name: 'POST API Call Action'
description: 'Send a POST request'
author: 'Derek Kershner'
branding:
icon: 'phone'
color: 'orange'
inputs:
url:
description: 'URL to send post request to'
required: true
data:
description: 'JSON string of data to pass into request'
default: '{}'
required: false
headers:
description: 'JSON string of headers to pass into request'
default: '{}'
required: false
params:
description: 'JSON string of query parameters to pass into request'
default: '{}'
required: false
runs:
using: 'node16'
main: 'dist/index.js'

4457
.old/dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest',
},
verbose: true,
};

14722
.old/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
{
"name": "post-api-call-action",
"version": "1.1.0",
"private": true,
"description": "Send a POST request action",
"main": "lib/main.js",
"scripts": {
"build": "tsc",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"pack": "ncc build",
"test": "jest --passWithNoTests",
"all": "npm run build && npm run format && npm run lint && npm run pack && npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dkershner6/post-api-call-action.git"
},
"keywords": [
"actions",
"node",
"setup"
],
"author": "Derek Kershner",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.3.0",
"axios": "^0.21.1"
},
"devDependencies": {
"@types/jest": "^26.0.23",
"@types/node": "^15.6.0",
"@typescript-eslint/parser": "^4.24.0",
"@vercel/ncc": "^0.28.5",
"eslint": "^7.26.0",
"eslint-plugin-github": "^4.1.3",
"eslint-plugin-jest": "^24.3.6",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"js-yaml": "^4.1.0",
"prettier": "^2.3.0",
"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
}
}

View File

@ -1,28 +0,0 @@
import { getInput, info, error, setFailed } from '@actions/core';
import axios from 'axios';
import { parseJsonSafely } from './parseJsonSafely';
async function run(): Promise<void> {
try {
const url: string = getInput('url');
const data = parseJsonSafely(getInput('data'));
const headers = parseJsonSafely(getInput('headers'));
const params = parseJsonSafely(getInput('params'));
info(`Sending POST request to ${url}`);
await axios.post(url, data, {
headers,
params,
});
} catch (err) {
if (err instanceof Error) {
error(err.message);
setFailed(err.message);
return;
}
setFailed('An unknown error occured');
}
}
run();

View File

@ -1,11 +0,0 @@
import { parseJsonSafely } from './parseJsonSafely';
it('Should parse example strings correctly', () => {
const testString = "{\"Authorization\": \"Bearer testsdtestdgsdsfgs\"}";
const result = parseJsonSafely(testString);
expect(result).toEqual({
Authorization: 'Bearer testsdtestdgsdsfgs',
});
});

View File

@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* 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'. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}

1
.prettierignore generated Normal file
View File

@ -0,0 +1 @@
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".

4
.prettierrc.json generated Normal file
View File

@ -0,0 +1,4 @@
{
"tabWidth": 4,
"overrides": []
}

32
.projen/deps.json generated
View File

@ -28,6 +28,14 @@
"version": "^10.0.0",
"type": "build"
},
{
"name": "dkershner6-projen-github-actions",
"type": "build"
},
{
"name": "eslint-config-prettier",
"type": "build"
},
{
"name": "eslint-import-resolver-typescript",
"type": "build"
@ -36,6 +44,18 @@
"name": "eslint-plugin-import",
"type": "build"
},
{
"name": "eslint-plugin-jest",
"type": "build"
},
{
"name": "eslint-plugin-prettier",
"type": "build"
},
{
"name": "eslint-plugin-sonarjs",
"type": "build"
},
{
"name": "eslint",
"version": "^8",
@ -50,6 +70,10 @@
"version": "^15",
"type": "build"
},
{
"name": "prettier",
"type": "build"
},
{
"name": "projen",
"type": "build"
@ -71,6 +95,10 @@
"name": "ts-node",
"type": "build"
},
{
"name": "typedoc",
"type": "build"
},
{
"name": "typescript",
"type": "build"
@ -82,6 +110,10 @@
{
"name": "@actions/github",
"type": "runtime"
},
{
"name": "axios",
"type": "runtime"
}
],
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."

8
.projen/files.json generated
View File

@ -3,6 +3,7 @@
".eslintrc.json",
".gitattributes",
".github/pull_request_template.md",
".github/workflows/auto-approve.yml",
".github/workflows/build.yml",
".github/workflows/pull-request-lint.yml",
".github/workflows/release.yml",
@ -10,13 +11,16 @@
".gitignore",
".mergify.yml",
".npmignore",
".npmrc",
".prettierignore",
".prettierrc.json",
".projen/deps.json",
".projen/files.json",
".projen/tasks.json",
"action.yml",
"LICENSE",
"tsconfig.dev.json",
"tsconfig.json"
"tsconfig.json",
"tsconfig.publish.json"
],
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
}

54
.projen/tasks.json generated
View File

@ -78,7 +78,7 @@
"description": "Only compile",
"steps": [
{
"exec": "tsc --build"
"exec": "tsc --build tsconfig.publish.json"
}
]
},
@ -87,7 +87,16 @@
"description": "Synthesize project files",
"steps": [
{
"exec": "ts-node --project tsconfig.dev.json .projenrc.ts"
"exec": "ts-node --project tsconfig.json .projenrc.ts"
}
]
},
"docgen": {
"name": "docgen",
"description": "Generate TypeScript API reference docs/",
"steps": [
{
"exec": "typedoc src --disableSources --out docs/"
}
]
},
@ -117,7 +126,7 @@
"description": "Install project dependencies and update lockfile (non-frozen)",
"steps": [
{
"exec": "yarn install --check-files"
"exec": "pnpm i --no-frozen-lockfile"
}
]
},
@ -126,7 +135,16 @@
"description": "Install project dependencies using frozen lockfile",
"steps": [
{
"exec": "yarn install --check-files --frozen-lockfile"
"exec": "pnpm i --frozen-lockfile"
}
]
},
"lint": {
"name": "lint",
"description": "Alternate lint command",
"steps": [
{
"spawn": "eslint"
}
]
},
@ -141,7 +159,12 @@
},
"post-compile": {
"name": "post-compile",
"description": "Runs after successful compilation"
"description": "Runs after successful compilation",
"steps": [
{
"spawn": "docgen"
}
]
},
"post-upgrade": {
"name": "post-upgrade",
@ -155,7 +178,8 @@
"name": "release",
"description": "Prepare a release from \"main\" branch",
"env": {
"RELEASE": "true"
"RELEASE": "true",
"MAJOR": "2"
},
"steps": [
{
@ -180,7 +204,7 @@
"description": "Run tests",
"steps": [
{
"exec": "jest --passWithNoTests --updateSnapshot",
"exec": "jest --passWithNoTests --coverageProvider=v8 --updateSnapshot",
"receiveArgs": true
},
{
@ -197,6 +221,14 @@
}
]
},
"type-check": {
"name": "type-check",
"steps": [
{
"exec": "tsc --noEmit"
}
]
},
"unbump": {
"name": "unbump",
"description": "Restores version to 0.0.0",
@ -221,13 +253,13 @@
},
"steps": [
{
"exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/jest,@types/node,@typescript-eslint/eslint-plugin,@typescript-eslint/parser,@vercel/ncc,constructs,eslint-import-resolver-typescript,eslint-plugin-import,eslint,jest,jest-junit,projen,projen-github-action-typescript,standard-version,ts-jest,ts-node,typescript,@actions/core,@actions/github"
"exec": "pnpx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/jest,@types/node,@typescript-eslint/eslint-plugin,@typescript-eslint/parser,@vercel/ncc,constructs,dkershner6-projen-github-actions,eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-jest,eslint-plugin-prettier,eslint-plugin-sonarjs,eslint,jest,jest-junit,prettier,projen,projen-github-action-typescript,standard-version,ts-jest,ts-node,typedoc,typescript,@actions/core,@actions/github,axios"
},
{
"exec": "yarn install --check-files"
"exec": "pnpm i --no-frozen-lockfile"
},
{
"exec": "yarn upgrade @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser @vercel/ncc constructs eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit projen projen-github-action-typescript standard-version ts-jest ts-node typescript @actions/core @actions/github"
"exec": "pnpm update @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser @vercel/ncc constructs dkershner6-projen-github-actions eslint-config-prettier eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest eslint-plugin-prettier eslint-plugin-sonarjs eslint jest jest-junit prettier projen projen-github-action-typescript standard-version ts-jest ts-node typedoc typescript @actions/core @actions/github axios"
},
{
"exec": "npx projen"
@ -248,7 +280,7 @@
}
},
"env": {
"PATH": "$(npx -c \"node --print process.env.PATH\")"
"PATH": "$(pnpm -c exec \"node --print process.env.PATH\")"
},
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
}

View File

@ -1,12 +1,60 @@
import { GitHubActionTypeScriptProject } from 'projen-github-action-typescript';
const project = new GitHubActionTypeScriptProject({
defaultReleaseBranch: 'main',
devDeps: ['projen-github-action-typescript'],
name: 'post-api-call-action',
projenrcTs: true,
import { Node20GitHubActionTypescriptProject } from "dkershner6-projen-github-actions";
// deps: [], /* Runtime dependencies of this module. */
// description: undefined, /* The description is just a string that helps people understand the purpose of the package. */
// packageName: undefined, /* The "name" in package.json. */
import { RunsUsing } from "projen-github-action-typescript";
const MAJOR_VERSION = 2;
const project = new Node20GitHubActionTypescriptProject({
majorVersion: MAJOR_VERSION,
defaultReleaseBranch: "main",
devDeps: [
"dkershner6-projen-github-actions",
"projen-github-action-typescript",
],
deps: ["axios"],
name: "post-api-call-action",
description: "Send a POST request action",
keywords: ["actions", "node", "setup"],
actionMetadata: {
name: "POST API Call Action",
description: "Send a POST request action",
inputs: {
url: { description: "URL to send post request to", required: true },
data: {
description: "JSON string of data to pass into request",
default: "{}",
required: false,
},
headers: {
description: "JSON string of headers to pass into request",
default: "{}",
required: false,
},
params: {
description:
"JSON string of query parameters to pass into request",
default: "{}",
required: false,
},
},
runs: {
using: RunsUsing.NODE_20,
main: "dist/index.js",
},
branding: {
icon: "phone",
color: "orange",
},
},
autoApproveOptions: {
allowedUsernames: ["dkershner6"],
},
sampleCode: false,
docgen: true,
});
project.synth();

View File

@ -1 +1,45 @@
# replace this
# webhook-action
GitHub Action that sends a POST request of any kind. This is a thin wrapper around Axios.post.
## Inputs
### `url`
**Required**: URL to send post request to.
### `data`
Optional: JSON string of data to pass into request. Default `"{}"`.
### `headers`
Optional: JSON string of headers to pass into request. Default `"{}"`.
### `params`
Optional: JSON string of query parameters to pass into request. Default `"{}"`.
## Example usage
```yaml
uses: dkershner6/post-api-call-action@v2
with:
url: ${{ secrets.API_URL }}
data: "{\"command\": \"publish\"}"
headers: "{\"Authorization\": \"Bearer ${{ secrets.API_KEY }}\"}"
params: "{\"content\": \"Test Content\"}"
```
## Contributing
All contributions are welcome, please open an issue or pull request.
To use this repository:
1. `npm i -g pnpm` (if don't have pnpm installed)
2. `pnpm i`
3. `npx projen` (this will ensure everything is setup correctly, and you can run this command at any time)
4. Good to make your changes!
5. You can run `npx projen build` at any time to build the project.

25
action.yml generated
View File

@ -1,7 +1,26 @@
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
name: post-api-call-action
description: A GitHub Action for post-api-call-action
name: POST API Call Action
description: Send a POST request action
runs:
using: node16
using: node20
main: dist/index.js
inputs:
url:
description: URL to send post request to
required: true
data:
description: JSON string of data to pass into request
default: "{}"
required: false
headers:
description: JSON string of headers to pass into request
default: "{}"
required: false
params:
description: JSON string of query parameters to pass into request
default: "{}"
required: false
branding:
icon: phone
color: orange

34500
dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

400
dist/licenses.txt generated vendored Normal file
View File

@ -0,0 +1,400 @@
@actions/core
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
@actions/http-client
MIT
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
@fastify/busboy
MIT
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
asynckit
MIT
The MIT License (MIT)
Copyright (c) 2016 Alex Indigo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
axios
MIT
# Copyright (c) 2014-present Matt Zabriskie & Collaborators
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
combined-stream
MIT
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
debug
MIT
(The MIT License)
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2018-2021 Josh Junon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the 'Software'), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
delayed-stream
MIT
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
follow-redirects
MIT
Copyright 2014present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
form-data
MIT
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
has-flag
MIT
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
mime-db
MIT
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2015-2022 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR 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.
mime-types
MIT
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR 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.
ms
MIT
The MIT License (MIT)
Copyright (c) 2016 Zeit, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
proxy-from-env
MIT
The MIT License
Copyright (C) 2016-2018 Rob Wu <rob@robwu.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
supports-color
MIT
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.
tunnel
MIT
The MIT License (MIT)
Copyright (c) 2012 Koichi Kobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
undici
MIT
MIT License
Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
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.
uuid
MIT
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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.

1
dist/sourcemap-register.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
docs/.nojekyll Normal file
View File

@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

57
docs/assets/highlight.css Normal file
View File

@ -0,0 +1,57 @@
:root {
--light-hl-0: #800000;
--dark-hl-0: #569CD6;
--light-hl-1: #000000;
--dark-hl-1: #D4D4D4;
--light-hl-2: #0000FF;
--dark-hl-2: #CE9178;
--light-hl-3: #A31515;
--dark-hl-3: #CE9178;
--light-hl-4: #EE0000;
--dark-hl-4: #D7BA7D;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
@media (prefers-color-scheme: light) { :root {
--hl-0: var(--light-hl-0);
--hl-1: var(--light-hl-1);
--hl-2: var(--light-hl-2);
--hl-3: var(--light-hl-3);
--hl-4: var(--light-hl-4);
--code-background: var(--light-code-background);
} }
@media (prefers-color-scheme: dark) { :root {
--hl-0: var(--dark-hl-0);
--hl-1: var(--dark-hl-1);
--hl-2: var(--dark-hl-2);
--hl-3: var(--dark-hl-3);
--hl-4: var(--dark-hl-4);
--code-background: var(--dark-code-background);
} }
:root[data-theme='light'] {
--hl-0: var(--light-hl-0);
--hl-1: var(--light-hl-1);
--hl-2: var(--light-hl-2);
--hl-3: var(--light-hl-3);
--hl-4: var(--light-hl-4);
--code-background: var(--light-code-background);
}
:root[data-theme='dark'] {
--hl-0: var(--dark-hl-0);
--hl-1: var(--dark-hl-1);
--hl-2: var(--dark-hl-2);
--hl-3: var(--dark-hl-3);
--hl-4: var(--dark-hl-4);
--code-background: var(--dark-code-background);
}
.hl-0 { color: var(--hl-0); }
.hl-1 { color: var(--hl-1); }
.hl-2 { color: var(--hl-2); }
.hl-3 { color: var(--hl-3); }
.hl-4 { color: var(--hl-4); }
pre, code { background: var(--code-background); }

59
docs/assets/main.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA4uOBQApu0wNAgAAAA=="

1
docs/assets/search.js Normal file
View File

@ -0,0 +1 @@
window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAAz2MMQqAMBAE/7J1sNDK/MAP2IiFmBUOkovEoIL4dwmK5ewscyHFY4MdRgNRxxP2ws60SVRY1FVTtTBYhN6VG3QKhMEcQ6BmjJ/rOeeY/tDOlOm6N1imVVZ6URa67wdtjdlXdgAAAA==";

1394
docs/assets/style.css Normal file

File diff suppressed because it is too large Load Diff

17
docs/index.html Normal file

File diff suppressed because one or more lines are too long

1
docs/modules.html Normal file

File diff suppressed because one or more lines are too long

30
package.json generated
View File

@ -1,13 +1,16 @@
{
"name": "post-api-call-action",
"description": "Send a POST request action",
"scripts": {
"build": "npx projen build",
"bump": "npx projen bump",
"clobber": "npx projen clobber",
"compile": "npx projen compile",
"default": "npx projen default",
"docgen": "npx projen docgen",
"eject": "npx projen eject",
"eslint": "npx projen eslint",
"lint": "npx projen lint",
"package": "npx projen package",
"post-compile": "npx projen post-compile",
"post-upgrade": "npx projen post-upgrade",
@ -15,6 +18,7 @@
"release": "npx projen release",
"test": "npx projen test",
"test:watch": "npx projen test:watch",
"type-check": "npx projen type-check",
"unbump": "npx projen unbump",
"upgrade": "npx projen upgrade",
"watch": "npx projen watch",
@ -27,26 +31,48 @@
"@typescript-eslint/parser": "^6",
"@vercel/ncc": "^0.38.1",
"constructs": "^10.0.0",
"dkershner6-projen-github-actions": "^0.0.2",
"eslint": "^8",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-sonarjs": "^0.23.0",
"jest": "^29.7.0",
"jest-junit": "^15",
"prettier": "^3.1.1",
"projen": "^0.78.5",
"projen-github-action-typescript": "^0.0.395",
"standard-version": "^9",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typedoc": "^0.25.4",
"typescript": "^5.3.3"
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0"
"@actions/github": "^6.0.0",
"axios": "^1.6.3"
},
"pnpm": {},
"keywords": [
"actions",
"node",
"setup"
],
"engines": {
"node": ">= 18.12.0 <= 20.10.0"
},
"main": "lib/index.js",
"license": "Apache-2.0",
"version": "0.0.0",
"jest": {
"testEnvironment": "node",
"transformIgnorePatterns": [
"node_modules/(?!(@babel/runtime|@buildresonance/global-lib-storefront-shared-components|@buildresonance/global-lib-storefront-next-markdown|@mui*|.*separated-tokens|.*util-gfm.*|bail|ccount|character-entities.*|decode-named-character-reference|direction|escape-string-regexp|github-slugger|hast.*|html-void-elements|is-plain-obj|longest-streak|markdown.*|mdast.*|micromark.*|property-information|rehype.*|remark.*|stringify-entities|strip-markdown|trim-lines|trough|unified|unist.*|vfile.*|web-namespaces|zwitch|@panva/hkdf|jose|swiper|swiper/react|ssr-window|dom7|uuid)/)",
"\\.pnp\\.[^\\/]+$"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
"<rootDir>/(test|src)/**/*(*.)@(spec|test).ts?(x)"
@ -83,7 +109,7 @@
"^.+\\.[t]sx?$": [
"ts-jest",
{
"tsconfig": "tsconfig.dev.json"
"tsconfig": "tsconfig.json"
}
]
}

5383
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,28 @@
export class Hello {
public sayHello() {
return 'hello, world!';
}
import { getInput, info, error, setFailed } from "@actions/core";
import axios, { AxiosHeaders } from "axios";
import { parseJsonSafely } from "./parseJsonSafely";
async function run(): Promise<void> {
try {
const url: string = getInput("url");
const data = parseJsonSafely(getInput("data"));
const headers = parseJsonSafely(getInput("headers")) as AxiosHeaders;
const params = parseJsonSafely(getInput("params"));
info(`Sending POST request to ${url}`);
await axios.post(url, data, {
headers,
params,
});
} catch (err) {
if (err instanceof Error) {
error(err.message);
setFailed(err.message);
return;
}
setFailed("An unknown error occured");
}
}
void run();

View File

@ -0,0 +1,11 @@
import { parseJsonSafely } from "./parseJsonSafely";
it("Should parse example strings correctly", () => {
const testString = '{"Authorization": "Bearer testsdtestdgsdsfgs"}';
const result = parseJsonSafely(testString);
expect(result).toEqual({
Authorization: "Bearer testsdtestdgsdsfgs",
});
});

View File

@ -1,4 +1,4 @@
import { error } from '@actions/core';
import { error } from "@actions/core";
export const parseJsonSafely = (jsonString: string): unknown => {
try {
@ -6,8 +6,8 @@ export const parseJsonSafely = (jsonString: string): unknown => {
} catch (err) {
error(
`Parsing error: ${jsonString} - ${
(err as Error)?.message ?? 'Unknown error while parsing JSON'
}`
(err as Error)?.message ?? "Unknown error while parsing JSON"
}`,
);
return {};
}

View File

@ -1,5 +0,0 @@
import { Hello } from '../src';
test('hello', () => {
expect(new Hello().sayHello()).toBe('hello, world!');
});

29
tsconfig.json generated
View File

@ -1,8 +1,6 @@
// ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
{
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"alwaysStrict": true,
"declaration": true,
"esModuleInterop": true,
@ -10,7 +8,7 @@
"inlineSourceMap": true,
"inlineSources": true,
"lib": [
"es2019"
"es2023"
],
"module": "CommonJS",
"noEmitOnError": false,
@ -18,17 +16,32 @@
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"resolveJsonModule": true,
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"stripInternal": true,
"target": "ES2019"
"target": "es2022",
"skipLibCheck": true,
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*.ts"
".projenrc.js",
"src/**/*.ts",
"test/**/*.ts",
"src/**/__tests__/**/*",
"src/**/__mocks__/**/*",
"src/**/*.test.ts",
"src/**/*.spec.ts",
".projenrc.ts",
"projenrc/**/*.ts"
],
"exclude": []
"exclude": [
"node_modules"
]
}

View File

@ -1,6 +1,8 @@
// ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
{
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"alwaysStrict": true,
"declaration": true,
"esModuleInterop": true,
@ -8,7 +10,7 @@
"inlineSourceMap": true,
"inlineSources": true,
"lib": [
"es2019"
"es2023"
],
"module": "CommonJS",
"noEmitOnError": false,
@ -16,23 +18,27 @@
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"resolveJsonModule": true,
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"stripInternal": true,
"target": "ES2019"
"target": "es2022",
"skipLibCheck": true,
"types": [
"jest",
"node"
]
},
"include": [
".projenrc.js",
"src/**/*.ts",
"test/**/*.ts",
".projenrc.ts",
"projenrc/**/*.ts"
"src/**/*.ts"
],
"exclude": [
"node_modules"
"src/**/*.test.ts",
"src/**/*.spec.ts",
"**/__tests__/**/*",
"**/__mocks__/**/*"
]
}

4785
yarn.lock

File diff suppressed because it is too large Load Diff