Skip to content

Commit

Permalink
Merge pull request #723 from acacode/update-gha
Browse files Browse the repository at this point in the history
Update GitHub Actions
  • Loading branch information
smorimoto authored May 4, 2024
2 parents 3c676d6 + abeaa50 commit 81f870c
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 171 deletions.
11 changes: 7 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 100
- package-ecosystem: github-actions
directory: /
schedule:
interval: "daily"
interval: weekly
- package-ecosystem: npm
directory: /
schedule:
interval: daily
81 changes: 6 additions & 75 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,89 +6,20 @@ on:

jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
node-version:
- 16.x
- 18.x

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

steps:
- name: Checkout tree
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Set-up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22
check-latest: true

- name: Install npm packages
run: npm ci --ignore-scripts

- name: Run the tests
run: npm run test-all

dependabot-auto-approve:
name: Dependabot auto-approve

permissions:
pull-requests: write

needs:
- build-and-test

if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}

runs-on: ubuntu-latest

steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1

- name: Get the PR review decision
id: gh-pr-review
run: echo "decision=$(gh pr view --json reviewDecision --jq '. | .reviewDecision' "$PR_URL")" >>"$GITHUB_OUTPUT"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ github.token }}

- name: Approve a PR
if: ${{ steps.gh-pr-review.outputs.decision != 'APPROVED' && steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ github.token }}

dependabot-auto-merge:
name: Dependabot auto-merge

permissions:
contents: write
pull-requests: write

if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}

needs:
- build-and-test
- dependabot-auto-approve

runs-on: ubuntu-latest

steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1

- name: Merge Dependabot PR
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ github.token }}
184 changes: 92 additions & 92 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,106 @@
"name": "swagger-typescript-api",
"version": "13.0.3",
"description": "Generate typescript/javascript api from swagger schema",
"keywords": [
"openapi",
"swagger",
"typescript",
"api",
"javascript",
"rest",
"codegen",
"generation",
"http"
],
"homepage": "https://github.com/acacode/swagger-typescript-api",
"bugs": {
"url": "https://github.com/acacode/swagger-typescript-api/issues"
},
"repository": {
"type": "git",
"url": "git://github.com/acacode/swagger-typescript-api"
},
"license": "MIT",
"author": "acacode",
"main": "src/index.js",
"typings": "./index.d.ts",
"bin": {
"sta": "index.js",
"swagger-typescript-api": "index.js"
},
"files": [
"src",
"index.js",
"index.d.ts",
"templates",
"cli",
"LICENSE"
],
"scripts": {
"update-deps-to-latest": "npx --yes npm-check-updates && npm i",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"cli:help": "node index.js -h",
"cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts",
"cli:yaml": "node index.js -r -d -p ./swagger-test-cli.yaml -n swagger-test-cli.ts",
"contributors": "all-contributors generate",
"generate": "node tests/generate.js",
"generate-extended": "node tests/generate-extended.js",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"node": "node swagger-test-cli/generate.js",
"node:debug": "node --nolazy swagger-test-cli/generate.js",
"contributors": "all-contributors generate",
"cli:help": "node index.js -h",
"test-all": "npm run test-extended && npm run test-simple && npm run test-specific",
"test-all(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true npm run test-all",
"test-simple": "node --unhandled-rejections=strict scripts_runner.js generate validate",
"test-extended": "node --unhandled-rejections=strict scripts_runner.js generate-extended validate",
"test-simple": "node --unhandled-rejections=strict scripts_runner.js generate validate",
"test-specific": "node --unhandled-rejections=strict scripts_runner.js test:*",
"test-specific(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true node --unhandled-rejections=strict scripts_runner.js test:*",
"generate": "node tests/generate.js",
"generate-extended": "node tests/generate-extended.js",
"validate": "node tests/validate.js",
"validate:debug": "node --nolazy tests/validate.js",
"test:--route-types": "node tests/spec/routeTypes/test.js",
"test:--no-client": "node tests/spec/noClient/test.js",
"test:--default-as-success": "node tests/spec/defaultAsSuccess/test.js",
"test:--templates": "node tests/spec/templates/test.js",
"test:--union-enums": "node tests/spec/unionEnums/test.js",
"test:--add-readonly": "node tests/spec/readonly/test.js",
"test:--responses": "node tests/spec/responses/test.js",
"test:specProperty": "node tests/spec/specProperty/test.js",
"test:--module-name-index": "node tests/spec/moduleNameIndex/test.js",
"test:--module-name-first-tag": "node tests/spec/moduleNameFirstTag/test.js",
"test:--modular": "node tests/spec/modular/test.js",
"test:--single-http-client": "node tests/spec/singleHttpClient/test.js",
"test:--extract-request-params": "node tests/spec/extractRequestParams/test.js",
"test:--another-array-type": "node tests/spec/another-array-type/test.js",
"test:--axios": "node tests/spec/axios/test.js",
"test:--axios--single-http-client": "node tests/spec/axiosSingleHttpClient/test.js",
"test:--cli": "rimraf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
"test:--default-as-success": "node tests/spec/defaultAsSuccess/test.js",
"test:--default-response": "node tests/spec/defaultResponse/test.js",
"test:--dot-path-params": "node tests/spec/dot-path-params/test.js",
"test:--enum-names-as-values": "node tests/spec/enumNamesAsValues/test.js",
"test:--extract-request-body": "node tests/spec/extractRequestBody/test.js",
"test:--extract-request-params": "node tests/spec/extractRequestParams/test.js",
"test:--extract-response-body": "node tests/spec/extractResponseBody/test.js",
"test:--extract-response-error": "node tests/spec/extractResponseError/test.js",
"test:--enum-names-as-values": "node tests/spec/enumNamesAsValues/test.js",
"test:--default-response": "node tests/spec/defaultResponse/test.js",
"test:const-keyword": "node tests/spec/const-keyword/test.js",
"test:--js": "node tests/spec/js/test.js",
"test:jsSingleHttpClientModular": "node tests/spec/jsSingleHttpClientModular/test.js",
"test:--js--axios": "node tests/spec/jsAxios/test.js",
"test:--axios": "node tests/spec/axios/test.js",
"test:--another-array-type": "node tests/spec/another-array-type/test.js",
"test:--modular": "node tests/spec/modular/test.js",
"test:--module-name-first-tag": "node tests/spec/moduleNameFirstTag/test.js",
"test:--module-name-index": "node tests/spec/moduleNameIndex/test.js",
"test:--no-client": "node tests/spec/noClient/test.js",
"test:--object-types": "node tests/spec/object-types/test.js",
"test:--axios--single-http-client": "node tests/spec/axiosSingleHttpClient/test.js",
"test:--type-suffix--type-prefix": "node tests/spec/typeSuffixPrefix/test.js",
"test:--dot-path-params": "node tests/spec/dot-path-params/test.js",
"test:--primitive-type-constructs": "node tests/spec/primitive-type-constructs/test.js",
"test:--cli": "rimraf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
"test:partialBaseTemplate": "node tests/spec/partialBaseTemplate/test.js",
"test:partialDefaultTemplate": "node tests/spec/partialDefaultTemplate/test.js",
"test:--patch": "node tests/spec/patch/test.js",
"test:deprecated": "node tests/spec/deprecated/test.js",
"test:nullableRefTest3.0": "node tests/spec/nullable-3.0/test.js",
"test:nullableRefTest2.0": "node tests/spec/nullable-2.0/test.js",
"test:--primitive-type-constructs": "node tests/spec/primitive-type-constructs/test.js",
"test:--responses": "node tests/spec/responses/test.js",
"test:--route-types": "node tests/spec/routeTypes/test.js",
"test:--single-http-client": "node tests/spec/singleHttpClient/test.js",
"test:--templates": "node tests/spec/templates/test.js",
"test:--type-suffix--type-prefix": "node tests/spec/typeSuffixPrefix/test.js",
"test:--union-enums": "node tests/spec/unionEnums/test.js",
"test:additionalProperties2.0": "node tests/spec/additional-properties-2.0/test.js",
"test:enums2.0": "node tests/spec/enums-2.0/test.js",
"test:another-query-params": "node tests/spec/another-query-params/test.js",
"test:on-insert-path-param": "node tests/spec/on-insert-path-param/test.js",
"test:const-keyword": "node tests/spec/const-keyword/test.js",
"test:deprecated": "node tests/spec/deprecated/test.js",
"test:discriminator": "node tests/spec/discriminator/test.js",
"test:enums2.0": "node tests/spec/enums-2.0/test.js",
"test:extra-templates": "node tests/spec/extra-templates/test.js",
"test:extract-enums": "node tests/spec/extract-enums/test.js",
"test:discriminator": "node tests/spec/discriminator/test.js",
"test:jsSingleHttpClientModular": "node tests/spec/jsSingleHttpClientModular/test.js",
"test:nullableRefTest2.0": "node tests/spec/nullable-2.0/test.js",
"test:nullableRefTest3.0": "node tests/spec/nullable-3.0/test.js",
"test:on-insert-path-param": "node tests/spec/on-insert-path-param/test.js",
"test:partialBaseTemplate": "node tests/spec/partialBaseTemplate/test.js",
"test:partialDefaultTemplate": "node tests/spec/partialDefaultTemplate/test.js",
"test:sort-types": "node tests/spec/sortTypes/test.js",
"test:sort-types-false": "node tests/spec/sortTypes-false/test.js"
},
"author": "acacode",
"license": "MIT",
"typings": "./index.d.ts",
"main": "src/index.js",
"devDependencies": {
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"@types/lodash": "^4.14.195",
"@types/node": "^20.4.1",
"@types/prettier": "^2.7.3",
"all-contributors-cli": "^6.26.1",
"axios": "^1.4.0",
"cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"git-diff": "^2.0.6",
"husky": "^8.0.3",
"pretty-quick": "^3.1.3",
"rimraf": "^5.0.1"
"test:sort-types-false": "node tests/spec/sortTypes-false/test.js",
"test:specProperty": "node tests/spec/specProperty/test.js",
"update-deps-to-latest": "npx --yes npm-check-updates && npm i",
"validate": "node tests/validate.js",
"validate:debug": "node --nolazy tests/validate.js"
},
"dependencies": {
"@types/swagger-schema-official": "2.0.22",
Expand All @@ -104,35 +119,20 @@
"swagger2openapi": "7.0.8",
"typescript": "5.1.6"
},
"bin": {
"swagger-typescript-api": "index.js",
"sta": "index.js"
},
"keywords": [
"openapi",
"swagger",
"typescript",
"api",
"javascript",
"rest",
"codegen",
"generation",
"http"
],
"files": [
"src",
"index.js",
"index.d.ts",
"templates",
"cli",
"LICENSE"
],
"bugs": {
"url": "https://github.com/acacode/swagger-typescript-api/issues"
},
"homepage": "https://github.com/acacode/swagger-typescript-api",
"repository": {
"type": "git",
"url": "git://github.com/acacode/swagger-typescript-api"
"devDependencies": {
"@types/lodash": "^4.14.195",
"@types/node": "^20.4.1",
"@types/prettier": "^2.7.3",
"all-contributors-cli": "^6.26.1",
"axios": "^1.4.0",
"cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"git-diff": "^2.0.6",
"husky": "^8.0.3",
"pretty-quick": "^3.1.3",
"rimraf": "^5.0.1"
}
}

0 comments on commit 81f870c

Please sign in to comment.