-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #380 from hey-api/package/upload-openapi-spec
chore: add upload-openapi-spec package
- Loading branch information
Showing
20 changed files
with
2,821 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
lib/ | ||
dist/ | ||
node_modules/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
|
||
dist/** -diff linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# 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/* | ||
|
||
# IDE files | ||
.idea | ||
.vscode | ||
*.code-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist/ | ||
node_modules/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"quoteProps": "as-needed", | ||
"jsxSingleQuote": false, | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"bracketSameLine": true, | ||
"arrowParens": "avoid", | ||
"proseWrap": "always", | ||
"htmlWhitespaceSensitivity": "css", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Upload OpenAPI Specification Action | ||
|
||
This action will upload your OpenAPI specification to Hey API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Unit tests for the action's entrypoint, src/index.ts | ||
*/ | ||
|
||
// import * as main from '../src/main' | ||
|
||
// // Mock the action's entrypoint | ||
// const runMock = jest.spyOn(main, 'run').mockImplementation() | ||
|
||
// describe('index', () => { | ||
// it('calls run when imported', async () => { | ||
// // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
// require('../src/index') | ||
|
||
// expect(runMock).toHaveBeenCalled() | ||
// }) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* Unit tests for the action's main functionality, src/main.ts | ||
* | ||
* These should be run as if the action was called from a workflow. | ||
* Specifically, the inputs listed in `action.yml` should be set as environment | ||
* variables following the pattern `INPUT_<INPUT_NAME>`. | ||
*/ | ||
|
||
// import * as core from '@actions/core' | ||
// import * as main from '../src/main' | ||
|
||
// // Mock the action's main function | ||
// const runMock = jest.spyOn(main, 'run') | ||
|
||
// // Other utilities | ||
// const timeRegex = /^\d{2}:\d{2}:\d{2}/ | ||
|
||
// // Mock the GitHub Actions core library | ||
// let debugMock: jest.SpiedFunction<typeof core.debug> | ||
// let errorMock: jest.SpiedFunction<typeof core.error> | ||
// let getInputMock: jest.SpiedFunction<typeof core.getInput> | ||
// let setFailedMock: jest.SpiedFunction<typeof core.setFailed> | ||
// let setOutputMock: jest.SpiedFunction<typeof core.setOutput> | ||
|
||
// describe('action', () => { | ||
// beforeEach(() => { | ||
// jest.clearAllMocks() | ||
|
||
// debugMock = jest.spyOn(core, 'debug').mockImplementation() | ||
// errorMock = jest.spyOn(core, 'error').mockImplementation() | ||
// getInputMock = jest.spyOn(core, 'getInput').mockImplementation() | ||
// setFailedMock = jest.spyOn(core, 'setFailed').mockImplementation() | ||
// setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation() | ||
// }) | ||
|
||
// it('sets the time output', async () => { | ||
// // Set the action's inputs as return values from core.getInput() | ||
// getInputMock.mockImplementation(name => { | ||
// switch (name) { | ||
// case 'milliseconds': | ||
// return '500' | ||
// default: | ||
// return '' | ||
// } | ||
// }) | ||
|
||
// await main.run() | ||
// expect(runMock).toHaveReturned() | ||
|
||
// // Verify that all of the core library functions were called correctly | ||
// expect(debugMock).toHaveBeenNthCalledWith(1, 'Waiting 500 milliseconds ...') | ||
// expect(debugMock).toHaveBeenNthCalledWith( | ||
// 2, | ||
// expect.stringMatching(timeRegex) | ||
// ) | ||
// expect(debugMock).toHaveBeenNthCalledWith( | ||
// 3, | ||
// expect.stringMatching(timeRegex) | ||
// ) | ||
// expect(setOutputMock).toHaveBeenNthCalledWith( | ||
// 1, | ||
// 'time', | ||
// expect.stringMatching(timeRegex) | ||
// ) | ||
// expect(errorMock).not.toHaveBeenCalled() | ||
// }) | ||
|
||
// it('sets a failed status', async () => { | ||
// // Set the action's inputs as return values from core.getInput() | ||
// getInputMock.mockImplementation(name => { | ||
// switch (name) { | ||
// case 'milliseconds': | ||
// return 'this is not a number' | ||
// default: | ||
// return '' | ||
// } | ||
// }) | ||
|
||
// await main.run() | ||
// expect(runMock).toHaveReturned() | ||
|
||
// // Verify that all of the core library functions were called correctly | ||
// expect(setFailedMock).toHaveBeenNthCalledWith( | ||
// 1, | ||
// 'milliseconds not a number' | ||
// ) | ||
// expect(errorMock).not.toHaveBeenCalled() | ||
// }) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Unit tests for src/wait.ts | ||
*/ | ||
|
||
// import { wait } from '../src/wait' | ||
// import { expect } from '@jest/globals' | ||
|
||
// describe('wait.ts', () => { | ||
// it('throws an invalid number', async () => { | ||
// const input = parseInt('foo', 10) | ||
// expect(isNaN(input)).toBe(true) | ||
|
||
// await expect(wait(input)).rejects.toThrow('milliseconds not a number') | ||
// }) | ||
|
||
// it('waits with a valid number', async () => { | ||
// const start = new Date() | ||
// await wait(500) | ||
// const end = new Date() | ||
|
||
// const delta = Math.abs(end.getTime() - start.getTime()) | ||
|
||
// expect(delta).toBeGreaterThan(450) | ||
// }) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Upload OpenAPI spec | ||
description: Upload your OpenAPI specification to Hey API | ||
author: Hey API | ||
|
||
branding: | ||
icon: heart | ||
color: red | ||
|
||
inputs: | ||
# TOOD: add token support | ||
# hey-api-token: | ||
# description: Hey API service token | ||
# required: true | ||
path-to-openapi: | ||
description: Input path to your OpenAPI specification file | ||
required: true | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.