Skip to content

Commit bc9b212

Browse files
v2.2.2 (#536)
* docs * Bump @types/node from 17.0.19 to 17.0.21 (#526) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 17.0.19 to 17.0.21. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/setup-node from 2.5.1 to 3 (#527) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.5.1 to 3. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v2.5.1...v3) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump eslint from 8.9.0 to 8.10.0 (#528) Bumps [eslint](https://github.com/eslint/eslint) from 8.9.0 to 8.10.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v8.9.0...v8.10.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Formatting * Foramtting * Better unit tests * Bump typescript from 4.5.5 to 4.6.2 (#529) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](microsoft/TypeScript@v4.5.5...v4.6.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @typescript-eslint/eslint-plugin from 5.11.0 to 5.13.0 (#530) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.11.0 to 5.13.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.13.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/checkout from 2.4.0 to 3 (#532) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2.4.0...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @typescript-eslint/parser from 5.11.0 to 5.13.0 (#531) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.11.0 to 5.13.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.13.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump eslint-config-prettier from 8.3.0 to 8.5.0 (#533) Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.3.0 to 8.5.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md) - [Commits](prettier/eslint-config-prettier@v8.3.0...v8.5.0) --- updated-dependencies: - dependency-name: eslint-config-prettier dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update README.md Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 7d27d4a commit bc9b212

File tree

13 files changed

+115
-101
lines changed

13 files changed

+115
-101
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v2.4.0
18+
uses: actions/checkout@v3
1919

20-
- uses: actions/setup-node@v2.5.1
20+
- uses: actions/setup-node@v3
2121
with:
2222
node-version: 'v14.18.1'
2323
registry-url: 'https://registry.npmjs.org'

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: Checkout repository
22-
uses: actions/checkout@v2.4.0
22+
uses: actions/checkout@v3
2323

2424
- name: Initialize CodeQL
2525
uses: github/codeql-action/init@v1

.github/workflows/integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout 🛎️
21-
uses: actions/checkout@v2.4.0
21+
uses: actions/checkout@v3
2222
with:
2323
persist-credentials: false
2424

@@ -43,7 +43,7 @@ jobs:
4343
needs: refresh-api-data
4444
steps:
4545
- name: Checkout 🛎️
46-
uses: actions/checkout@v2.4.0
46+
uses: actions/checkout@v3
4747
with:
4848
persist-credentials: false
4949

.github/workflows/production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v2.4.0
17+
uses: actions/checkout@v3
1818

19-
- uses: actions/setup-node@v2.5.1
19+
- uses: actions/setup-node@v3
2020
with:
2121
node-version: 'v14.18.1'
2222
registry-url: 'https://registry.npmjs.org'

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2.4.0
13+
- uses: actions/checkout@v3
1414
with:
1515
ref: dev
1616

1717
# Setup .npmrc file to publish to npm
18-
- uses: actions/setup-node@v2.5.1
18+
- uses: actions/setup-node@v3
1919
with:
2020
node-version: 'v14.18.1'
2121
registry-url: 'https://registry.npmjs.org'
@@ -40,7 +40,7 @@ jobs:
4040
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4141

4242
# Setup .npmrc file to publish to GitHub Packages
43-
- uses: actions/setup-node@v2.5.1
43+
- uses: actions/setup-node@v3
4444
with:
4545
node-version: 12
4646
registry-url: 'https://npm.pkg.github.com'

.github/workflows/sponsors.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout 🛎️
12-
uses: actions/checkout@v2.4.0
12+
uses: actions/checkout@v3
1313

1414
- name: Generate Sponsors 💖
1515
uses: JamesIves/github-sponsors-readme-action@v1.0.8
@@ -18,7 +18,7 @@ jobs:
1818
file: 'README.md'
1919
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="50px" alt="{{{ login }}}" /></a>&nbsp;&nbsp;'
2020
maximum: 9999
21-
21+
2222
- name: Generate Sponsors 💖
2323
uses: JamesIves/github-sponsors-readme-action@v1.0.8
2424
with:
@@ -28,7 +28,6 @@ jobs:
2828
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="80px" alt="{{{ login }}}" /></a>&nbsp;&nbsp;'
2929
marker: 'premium'
3030

31-
3231
- name: Deploy to GitHub Pages
3332
uses: JamesIves/github-pages-deploy-action@v4.2.5
3433
with:

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
<img src="https://github.com/JamesIves/fetch-api-data-action/raw/dev/assets/screenshot.png">
3939
</p>
4040

41-
4241
<p align="center">
4342
Maintainence of this project is made possible by all the <a href="https://github.com/JamesIves/github-pages-deploy-action/graphs/contributors">contributors</a> and <a href="https://github.com/sponsors/JamesIves">sponsors</a>. If you'd like to sponsor this project and have your avatar or company logo appear below <a href="https://github.com/sponsors/JamesIves">click here</a>. 💖
4443
</p>
@@ -93,7 +92,7 @@ jobs:
9392
persist-credentials: false
9493
9594
- name: Fetch API Data 📦
96-
uses: JamesIves/fetch-api-data-action@v2.1.0
95+
uses: JamesIves/fetch-api-data-action@v2.2.2
9796
with:
9897
endpoint: https://example.com
9998
configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer ${{ secrets.API_TOKEN }}"} }'
@@ -192,7 +191,7 @@ The following configuration options should be set.
192191
| `retry` | If you're working with an intermittent API you can toggle this option to `true`. Doing so will make the action try the request 3 times at random invervals before failing. | `with` | **No** |
193192
| `save-location` | By default the save location of the file is `fetch-api-data-action/data.json`, if you'd like to override the directory you can do so by specifying a new one with this variable. | `with` | **No** |
194193
| `save-name` | You can override the name of the exported `.json` file by specifying a new one here. You should _not_ include the file extension in your name. | `with` | **No** |
195-
| `set-output` | Determines if the returned data should be saved as an environment variable or not. This field defaults to `true`. | `with` | **No** |
194+
| `set-output` | Determines if the returned data should be saved as an environment variable or not. This field defaults to `true`, but depending on your API response length you may need to toggle this. | `with` | **No** |
196195
| `format` | Allows you to modify the extension of the file saved from the API response, for example you can set this field to `json` or `txt`. This field defaults to `json`. | `with` | **No** |
197196
| `encoding` | Allows you to modify the encoding of the file saved from the API response, for example you can set this field to `utf8` or `hex`. This field defaults to `utf8`. Choose from `ascii`, `utf8`, `utf-8`, `utf16le`, `ucs2`, `ucs-2`, `base64`, `latin1`, `binary` or `hex`. | `with` | **No** |
198197
| `debug` | If set to `true` the action will log the API responses it receives in the terminal. | `with` | **No** |
@@ -211,7 +210,7 @@ jobs:
211210
runs-on: ubuntu-latest
212211
steps:
213212
- name: Fetch API Data 📦
214-
uses: JamesIves/fetch-api-data-action@v2.1.0
213+
uses: JamesIves/fetch-api-data-action@v2.2.2
215214
with:
216215
# The token endpoint is requested first. This retrieves the access token for the other endpoint.
217216
token-endpoint: https://example.com/auth/token

__tests__/fetch.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ describe('fetch', () => {
110110
describe('generateExport', () => {
111111
it('should save the file', async () => {
112112
await generateExport({
113-
data: '{"bestCat":"montezuma"}'
113+
data: '{"bestCat":"montezuma"}',
114+
setOutput: true
114115
})
115116
expect(process.env['fetch-api-data']).toBe('{"bestCat":"montezuma"}')
116117
})
@@ -120,7 +121,8 @@ describe('fetch', () => {
120121
data: 'hello',
121122
format: 'txt',
122123
saveLocation: 'fetch-api-data-custom',
123-
saveName: 'montezuma'
124+
saveName: 'montezuma',
125+
setOutput: true
124126
})
125127
expect(process.env['fetch-api-data']).toBe('hello')
126128
})
@@ -129,7 +131,8 @@ describe('fetch', () => {
129131
await generateExport({
130132
data: '{"bestCat":"montezuma"}',
131133
saveLocation: 'fetch-api-data-custom',
132-
saveName: 'montezuma'
134+
saveName: 'montezuma',
135+
setOutput: true
133136
})
134137
expect(process.env['fetch-api-data']).toBe('{"bestCat":"montezuma"}')
135138
})
@@ -139,7 +142,8 @@ describe('fetch', () => {
139142
data: '68656C6C6F21',
140143
encoding: 'hex',
141144
format: 'txt',
142-
saveName: 'hex-data'
145+
saveName: 'hex-data',
146+
setOutput: true
143147
})
144148
expect(process.env['fetch-api-data']).toBe('68656C6C6F21')
145149
})
@@ -150,7 +154,8 @@ describe('fetch', () => {
150154
data: '68656C6C6F21',
151155
encoding: 'hexxxxx' as BufferEncoding,
152156
format: 'txt',
153-
saveName: 'hex-data'
157+
saveName: 'hex-data',
158+
setOutput: true
154159
})
155160
} catch (error) {
156161
expect(error instanceof Error && error.message).toBe(

__tests__/lib.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,25 @@ describe('lib', () => {
3030
it('should run through the commands', async () => {
3131
Object.assign(action, {
3232
debug: true,
33-
endpoint: 'https://jamesiv.es'
33+
endpoint: 'https://jamesiv.es',
34+
setOutput: true
3435
})
3536
await run(action)
3637

3738
expect(exportVariable).toBeCalled()
3839
})
3940

41+
it('should run through the commands but not save output', async () => {
42+
Object.assign(action, {
43+
debug: true,
44+
endpoint: 'https://jamesiv.es',
45+
setOutput: false
46+
})
47+
await run(action)
48+
49+
expect(exportVariable).toBeCalledTimes(0)
50+
})
51+
4052
it('should throw an error if no endpoint is provided', async () => {
4153
Object.assign(action, {
4254
debug: true,

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inputs:
3737
required: false
3838

3939
set-output:
40-
description: 'Determines if the returned data should be saved as an environment variable or not. This field defaults to `true`.'
40+
description: 'Determines if the returned data should be saved as an environment variable or not. This field defaults to `true`, but depending on your API response length you may need to toggle this.'
4141
required: false
4242
default: 'true'
4343

0 commit comments

Comments
 (0)