From ab3230022e8e8d505e9d460c37bcdfea63924f28 Mon Sep 17 00:00:00 2001 From: James Ives Date: Mon, 10 Jan 2022 14:42:33 +0000 Subject: [PATCH 1/8] =?UTF-8?q?Release=202.1.0=20=F0=9F=93=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e7c37843..f60f904b4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@jamesives/fetch-api-data-action", "description": "GitHub action for handling authenticated API requests, allowing you to save the data from the request into your workspace as an environment variable and a .json file.", "author": "James Ives (https://jamesiv.es)", - "version": "2.0.1", + "version": "2.1.0", "license": "MIT", "main": "lib/lib.js", "types": "lib/lib.d.ts", From 413dc3cfa1c92db2a706ba3898a968952a6a6eda Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 08:14:31 -0500 Subject: [PATCH 2/8] Bump JamesIves/github-sponsors-readme-action from 1.0.7 to 1.0.8 (#479) Bumps [JamesIves/github-sponsors-readme-action](https://github.com/JamesIves/github-sponsors-readme-action) from 1.0.7 to 1.0.8. - [Release notes](https://github.com/JamesIves/github-sponsors-readme-action/releases) - [Commits](https://github.com/JamesIves/github-sponsors-readme-action/compare/1.0.7...v1.0.8) --- updated-dependencies: - dependency-name: JamesIves/github-sponsors-readme-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/sponsors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sponsors.yml b/.github/workflows/sponsors.yml index c9655e93f..59131b47e 100644 --- a/.github/workflows/sponsors.yml +++ b/.github/workflows/sponsors.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v2.4.0 - name: Generate Sponsors 💖 - uses: JamesIves/github-sponsors-readme-action@1.0.7 + uses: JamesIves/github-sponsors-readme-action@v1.0.8 with: token: ${{ secrets.PAT }} file: 'README.md' From 20a44e47c27f587bce9cc167bdafa84d4b429063 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 08:15:06 -0500 Subject: [PATCH 3/8] Bump nock from 13.2.1 to 13.2.2 (#476) Bumps [nock](https://github.com/nock/nock) from 13.2.1 to 13.2.2. - [Release notes](https://github.com/nock/nock/releases) - [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md) - [Commits](https://github.com/nock/nock/compare/v13.2.1...v13.2.2) --- updated-dependencies: - dependency-name: nock dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f60f904b4..c65927c2b 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "eslint-plugin-prettier": "4.0.0", "jest": "27.4.7", "jest-circus": "27.4.6", - "nock": "13.2.1", + "nock": "13.2.2", "prettier": "2.5.1", "ts-jest": "27.1.2", "typescript": "4.5.4" diff --git a/yarn.lock b/yarn.lock index 9e34d7c58..b76054423 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2657,10 +2657,10 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" -nock@13.2.1: - version "13.2.1" - resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.1.tgz#fcf5bdb9bb9f0554a84c25d3333166c0ffd80858" - integrity sha512-CoHAabbqq/xZEknubuyQMjq6Lfi5b7RtK6SoNK6m40lebGp3yiMagWtIoYaw2s9sISD7wPuCfwFpivVHX/35RA== +nock@13.2.2: + version "13.2.2" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.2.tgz#29a6942250278209c2b3e7a38310f703581b21fa" + integrity sha512-PcBHuvl9i6zfaJ50A7LS55oU+nFLv8htXIhffJO+FxyfibdZ4jEvd9kTuvkrJireBFIGMZ+oUIRpMK5gU9h//g== dependencies: debug "^4.1.0" json-stringify-safe "^5.0.1" From 6b8f3a3f2fd9b2027a239ed7f08b636827fe5fe6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 08:15:14 -0500 Subject: [PATCH 4/8] Bump @typescript-eslint/parser from 5.9.0 to 5.9.1 (#477) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.9.0 to 5.9.1. - [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.9.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index c65927c2b..4f8b6910d 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@types/mustache": "4.1.2", "@types/node": "17.0.8", "@typescript-eslint/eslint-plugin": "5.9.0", - "@typescript-eslint/parser": "5.9.0", + "@typescript-eslint/parser": "5.9.1", "eslint": "8.6.0", "eslint-config-prettier": "8.3.0", "eslint-plugin-jest": "25.3.4", diff --git a/yarn.lock b/yarn.lock index b76054423..1240fcd57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -993,14 +993,14 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/parser@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.9.0.tgz#fdbb08767a4caa6ca6ccfed5f9ffe9387f0c7d97" - integrity sha512-/6pOPz8yAxEt4PLzgbFRDpZmHnXCeZgPDrh/1DaVKOjvn/UPMlWhbx/gA96xRi2JxY1kBl2AmwVbyROUqys5xQ== - dependencies: - "@typescript-eslint/scope-manager" "5.9.0" - "@typescript-eslint/types" "5.9.0" - "@typescript-eslint/typescript-estree" "5.9.0" +"@typescript-eslint/parser@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.9.1.tgz#b114011010a87e17b3265ca715e16c76a9834cef" + integrity sha512-PLYO0AmwD6s6n0ZQB5kqPgfvh73p0+VqopQQLuNfi7Lm0EpfKyDalchpVwkE+81k5HeiRrTV/9w1aNHzjD7C4g== + dependencies: + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/typescript-estree" "5.9.1" debug "^4.3.2" "@typescript-eslint/scope-manager@5.9.0": @@ -1011,6 +1011,14 @@ "@typescript-eslint/types" "5.9.0" "@typescript-eslint/visitor-keys" "5.9.0" +"@typescript-eslint/scope-manager@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.9.1.tgz#6c27be89f1a9409f284d95dfa08ee3400166fe69" + integrity sha512-8BwvWkho3B/UOtzRyW07ffJXPaLSUKFBjpq8aqsRvu6HdEuzCY57+ffT7QoV4QXJXWSU1+7g3wE4AlgImmQ9pQ== + dependencies: + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/visitor-keys" "5.9.1" + "@typescript-eslint/type-utils@5.9.0": version "5.9.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.0.tgz#fd5963ead04bc9b7af9c3a8e534d8d39f1ce5f93" @@ -1025,6 +1033,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.0.tgz#e5619803e39d24a03b3369506df196355736e1a3" integrity sha512-mWp6/b56Umo1rwyGCk8fPIzb9Migo8YOniBGPAQDNC6C52SeyNGN4gsVwQTAR+RS2L5xyajON4hOLwAGwPtUwg== +"@typescript-eslint/types@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.1.tgz#1bef8f238a2fb32ebc6ff6d75020d9f47a1593c6" + integrity sha512-SsWegWudWpkZCwwYcKoDwuAjoZXnM1y2EbEerTHho19Hmm+bQ56QG4L4jrtCu0bI5STaRTvRTZmjprWlTw/5NQ== + "@typescript-eslint/typescript-estree@5.9.0": version "5.9.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.0.tgz#0e5c6f03f982931abbfbc3c1b9df5fbf92a3490f" @@ -1038,6 +1051,19 @@ semver "^7.3.5" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.1.tgz#d5b996f49476495070d2b8dd354861cf33c005d6" + integrity sha512-gL1sP6A/KG0HwrahVXI9fZyeVTxEYV//6PmcOn1tD0rw8VhUWYeZeuWHwwhnewnvEMcHjhnJLOBhA9rK4vmb8A== + dependencies: + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/visitor-keys" "5.9.1" + debug "^4.3.2" + globby "^11.0.4" + is-glob "^4.0.3" + semver "^7.3.5" + tsutils "^3.21.0" + "@typescript-eslint/visitor-keys@5.9.0": version "5.9.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.0.tgz#7585677732365e9d27f1878150fab3922784a1a6" @@ -1046,6 +1072,14 @@ "@typescript-eslint/types" "5.9.0" eslint-visitor-keys "^3.0.0" +"@typescript-eslint/visitor-keys@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.1.tgz#f52206f38128dd4f675cf28070a41596eee985b7" + integrity sha512-Xh37pNz9e9ryW4TVdwiFzmr4hloty8cFj8GTWMXh3Z8swGwyQWeCcNgF0hm6t09iZd6eiZmIf4zHedQVP6TVtg== + dependencies: + "@typescript-eslint/types" "5.9.1" + eslint-visitor-keys "^3.0.0" + abab@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" From 1ff2fadab1ebe05fae2b7b2f43333d28dbe6537e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 08:43:33 -0500 Subject: [PATCH 5/8] Bump @typescript-eslint/eslint-plugin from 5.9.0 to 5.9.1 (#478) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.9.0 to 5.9.1. - [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.9.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 74 ++++++++++++++-------------------------------------- 2 files changed, 21 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index 4f8b6910d..7c56f333c 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@types/jest": "27.4.0", "@types/mustache": "4.1.2", "@types/node": "17.0.8", - "@typescript-eslint/eslint-plugin": "5.9.0", + "@typescript-eslint/eslint-plugin": "5.9.1", "@typescript-eslint/parser": "5.9.1", "eslint": "8.6.0", "eslint-config-prettier": "8.3.0", diff --git a/yarn.lock b/yarn.lock index 1240fcd57..b85f59859 100644 --- a/yarn.lock +++ b/yarn.lock @@ -966,14 +966,14 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.0.tgz#382182d5cb062f52aac54434cfc47c28898c8006" - integrity sha512-qT4lr2jysDQBQOPsCCvpPUZHjbABoTJW8V9ZzIYKHMfppJtpdtzszDYsldwhFxlhvrp7aCHeXD1Lb9M1zhwWwQ== - dependencies: - "@typescript-eslint/experimental-utils" "5.9.0" - "@typescript-eslint/scope-manager" "5.9.0" - "@typescript-eslint/type-utils" "5.9.0" +"@typescript-eslint/eslint-plugin@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.1.tgz#e5a86d7e1f9dc0b3df1e6d94feaf20dd838d066c" + integrity sha512-Xv9tkFlyD4MQGpJgTo6wqDqGvHIRmRgah/2Sjz1PUnJTawjHWIwBivUE9x0QtU2WVii9baYgavo/bHjrZJkqTw== + dependencies: + "@typescript-eslint/experimental-utils" "5.9.1" + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/type-utils" "5.9.1" debug "^4.3.2" functional-red-black-tree "^1.0.1" ignore "^5.1.8" @@ -981,15 +981,15 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@5.9.0", "@typescript-eslint/experimental-utils@^5.0.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.0.tgz#652762d37d6565ef07af285021b8347b6c79a827" - integrity sha512-ZnLVjBrf26dn7ElyaSKa6uDhqwvAi4jBBmHK1VxuFGPRAxhdi18ubQYSGA7SRiFiES3q9JiBOBHEBStOFkwD2g== +"@typescript-eslint/experimental-utils@5.9.1", "@typescript-eslint/experimental-utils@^5.0.0": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.1.tgz#8c407c4dd5ffe522329df6e4c9c2b52206d5f7f1" + integrity sha512-cb1Njyss0mLL9kLXgS/eEY53SZQ9sT519wpX3i+U457l2UXRDuo87hgKfgRazmu9/tQb0x2sr3Y0yrU+Zz0y+w== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.9.0" - "@typescript-eslint/types" "5.9.0" - "@typescript-eslint/typescript-estree" "5.9.0" + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/typescript-estree" "5.9.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" @@ -1003,14 +1003,6 @@ "@typescript-eslint/typescript-estree" "5.9.1" debug "^4.3.2" -"@typescript-eslint/scope-manager@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.9.0.tgz#02dfef920290c1dcd7b1999455a3eaae7a1a3117" - integrity sha512-DKtdIL49Qxk2a8icF6whRk7uThuVz4A6TCXfjdJSwOsf+9ree7vgQWcx0KOyCdk0i9ETX666p4aMhrRhxhUkyg== - dependencies: - "@typescript-eslint/types" "5.9.0" - "@typescript-eslint/visitor-keys" "5.9.0" - "@typescript-eslint/scope-manager@5.9.1": version "5.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.9.1.tgz#6c27be89f1a9409f284d95dfa08ee3400166fe69" @@ -1019,38 +1011,20 @@ "@typescript-eslint/types" "5.9.1" "@typescript-eslint/visitor-keys" "5.9.1" -"@typescript-eslint/type-utils@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.0.tgz#fd5963ead04bc9b7af9c3a8e534d8d39f1ce5f93" - integrity sha512-uVCb9dJXpBrK1071ri5aEW7ZHdDHAiqEjYznF3HSSvAJXyrkxGOw2Ejibz/q6BXdT8lea8CMI0CzKNFTNI6TEQ== +"@typescript-eslint/type-utils@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.1.tgz#c6832ffe655b9b1fec642d36db1a262d721193de" + integrity sha512-tRSpdBnPRssjlUh35rE9ug5HrUvaB9ntREy7gPXXKwmIx61TNN7+l5YKgi1hMKxo5NvqZCfYhA5FvyuJG6X6vg== dependencies: - "@typescript-eslint/experimental-utils" "5.9.0" + "@typescript-eslint/experimental-utils" "5.9.1" debug "^4.3.2" tsutils "^3.21.0" -"@typescript-eslint/types@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.0.tgz#e5619803e39d24a03b3369506df196355736e1a3" - integrity sha512-mWp6/b56Umo1rwyGCk8fPIzb9Migo8YOniBGPAQDNC6C52SeyNGN4gsVwQTAR+RS2L5xyajON4hOLwAGwPtUwg== - "@typescript-eslint/types@5.9.1": version "5.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.1.tgz#1bef8f238a2fb32ebc6ff6d75020d9f47a1593c6" integrity sha512-SsWegWudWpkZCwwYcKoDwuAjoZXnM1y2EbEerTHho19Hmm+bQ56QG4L4jrtCu0bI5STaRTvRTZmjprWlTw/5NQ== -"@typescript-eslint/typescript-estree@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.0.tgz#0e5c6f03f982931abbfbc3c1b9df5fbf92a3490f" - integrity sha512-kxo3xL2mB7XmiVZcECbaDwYCt3qFXz99tBSuVJR4L/sR7CJ+UNAPrYILILktGj1ppfZ/jNt/cWYbziJUlHl1Pw== - dependencies: - "@typescript-eslint/types" "5.9.0" - "@typescript-eslint/visitor-keys" "5.9.0" - debug "^4.3.2" - globby "^11.0.4" - is-glob "^4.0.3" - semver "^7.3.5" - tsutils "^3.21.0" - "@typescript-eslint/typescript-estree@5.9.1": version "5.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.9.1.tgz#d5b996f49476495070d2b8dd354861cf33c005d6" @@ -1064,14 +1038,6 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/visitor-keys@5.9.0": - version "5.9.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.0.tgz#7585677732365e9d27f1878150fab3922784a1a6" - integrity sha512-6zq0mb7LV0ThExKlecvpfepiB+XEtFv/bzx7/jKSgyXTFD7qjmSu1FoiS0x3OZaiS+UIXpH2vd9O89f02RCtgw== - dependencies: - "@typescript-eslint/types" "5.9.0" - eslint-visitor-keys "^3.0.0" - "@typescript-eslint/visitor-keys@5.9.1": version "5.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.9.1.tgz#f52206f38128dd4f675cf28070a41596eee985b7" From 8b785b81669d41749ed335cefbff0335ff190263 Mon Sep 17 00:00:00 2001 From: James Ives Date: Tue, 11 Jan 2022 15:10:32 -0500 Subject: [PATCH 6/8] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c9a4c85a2..516b45a66 100644 --- a/README.md +++ b/README.md @@ -146,13 +146,13 @@ import run, { retrieveData, generateExport, ActionInterface -} from 'fetch-api-data-action' +} from '@jamesives/fetch-api-data-action' ``` Calling the functions directly will require you to pass in an object containing the variables found in the [configuration section](https://github.com/JamesIves/fetch-api-data-action#configuration-). ```javascript -import run from 'fetch-api-data-action' +import run from '@jamesives/fetch-api-data-action' run({ endpoint: 'https://example.com', From 5e9582c301a6df3259b5f3ae2b0299bcb224c66c Mon Sep 17 00:00:00 2001 From: Rwitick Ghosh <58736240+humble-barnacle001@users.noreply.github.com> Date: Wed, 12 Jan 2022 09:33:59 +0530 Subject: [PATCH 7/8] Add encoding option (#480) --- .github/workflows/version.yml | 4 ++-- README.md | 3 ++- __tests__/fetch.test.ts | 10 ++++++++++ action.yml | 5 +++++ src/constants.ts | 5 +++++ src/fetch.ts | 11 +++-------- src/lib.ts | 1 + 7 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index b9c0e71ce..3e86f81ea 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -3,11 +3,11 @@ name: Update Major Version Tag on: push: tags: - - "v*" + - 'v*' jobs: update-majorver: name: Update Major Version Tag runs-on: ubuntu-latest steps: - - uses: nowactions/update-majorver@v1 \ No newline at end of file + - uses: nowactions/update-majorver@v1 diff --git a/README.md b/README.md index 516b45a66..18bb2fa91 100644 --- a/README.md +++ b/README.md @@ -183,9 +183,10 @@ The following configuration options should be set. | `token-endpoint` | If the `endpoint` API requires you to make a request to get an access token prior to fetching data you can perform this task by specifying a token endpoint. Any data returned from the token end can be referenced in the `configuration` variable using the triple bracket syntax: `{{{ access_token }}}`. For more information refer to the [Token Request part of the readme](https://github.com/JamesIves/fetch-api-data-action#token-request-%EF%B8%8F); | `with` | **No** | | `token-configuration` | Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the `${{ secrets.secret_name }}` syntax. For more information refer to the [Fetch API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch). | `secrets / with` | **No** | | `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** | -| `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** | +| `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** | | `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** | | `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** | +| `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 `hex`. Choose from `ascii` or `utf8` or `utf-8` or `utf16le` or `ucs2` or `ucs-2` or `base64` or `latin1` or `binary` or `hex` | `with` | **No** | | `debug` | If set to `true` the action will log the API responses it receives in the terminal. | `with` | **No** | --- diff --git a/__tests__/fetch.test.ts b/__tests__/fetch.test.ts index 2867d5419..a3c8fc173 100644 --- a/__tests__/fetch.test.ts +++ b/__tests__/fetch.test.ts @@ -133,5 +133,15 @@ describe('fetch', () => { }) expect(process.env['fetch-api-data']).toBe('{"bestCat":"montezuma"}') }) + + it('should save file with custom encoding', async () => { + await generateExport({ + data: '68656C6C6F21', + encoding: 'hex', + format: 'txt', + saveName: 'hex-data' + }) + expect(process.env['fetch-api-data']).toBe('68656C6C6F21') + }) }) }) diff --git a/action.yml b/action.yml index f05663342..c9f2cddd4 100644 --- a/action.yml +++ b/action.yml @@ -42,6 +42,11 @@ inputs: format: description: 'Allows you to modify the format of the saved file, for example you can use txt here to save the file as a txt file. This field defaults to json.' + required: false + + encoding: + description: 'Allows you to specify the encoding the saved file, can be of type BufferEncoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex".' + required: false outputs: fetch-api-data: diff --git a/src/constants.ts b/src/constants.ts index 712f988d4..ac11077e6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,6 +4,8 @@ import {isNullOrUndefined} from './util' export interface ActionInterface { /** Allows you to log the retrieved data to the terminal. */ debug?: boolean + /** The encoding of the data to be finally stored */ + encoding?: BufferEncoding /** The primary endpoint to fetch data from. */ endpoint: string /** The configuration for the primary endpoint. Must be a stringified JSON object. */ @@ -40,6 +42,8 @@ export interface DataInterface { export interface ExportInterface { /** The data to save. */ data: string + /** The encoding of the data to be finally stored */ + encoding?: BufferEncoding /** The save location. */ saveLocation?: string /** The name of the file to save. */ @@ -53,6 +57,7 @@ export const action = { debug: !isNullOrUndefined(getInput('debug')) ? getInput('debug').toLowerCase() === 'true' : false, + encoding: getInput('encoding'), endpoint: getInput('endpoint'), configuration: getInput('configuration'), tokenEndpoint: getInput('token-endpoint'), diff --git a/src/fetch.ts b/src/fetch.ts index 4d1f0a4d4..810bdcaf5 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -65,6 +65,7 @@ export async function retrieveData({ /* Saves the data to the local file system and exports an environment variable containing the retrieved data. */ export async function generateExport({ data, + encoding, format, saveLocation, saveName @@ -73,17 +74,11 @@ export async function generateExport({ const file = `${saveLocation ? saveLocation : 'fetch-api-data-action'}/${ saveName ? saveName : 'data' }.${format ? format : 'json'}` + const dataEncoding = encoding ? encoding : 'utf8' await mkdirP(`${saveLocation ? saveLocation : 'fetch-api-data-action'}`) - await fs.writeFile(file, data, 'utf8') + await fs.writeFile(file, data, dataEncoding) info(`Saved ${file} 💾`) - await fs.writeFile( - `${saveLocation ? saveLocation : 'fetch-api-data-action'}/${ - saveName ? saveName : 'data' - }.json`, - data, - 'utf8' - ) exportVariable('fetch-api-data', data) diff --git a/src/lib.ts b/src/lib.ts index 049e14977..c0bbcfc92 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -52,6 +52,7 @@ export default async function run( status = await generateExport({ data, + encoding: settings.encoding, saveLocation: settings.saveLocation, saveName: settings.saveName, format: settings.format From efa15979627bdeceeb451bc931405b0a37479f59 Mon Sep 17 00:00:00 2001 From: James Ives Date: Tue, 11 Jan 2022 23:19:01 -0500 Subject: [PATCH 8/8] Adjustments --- .github/workflows/integration.yml | 28 +++++++++++++++++++++++++++- .github/workflows/version.yml | 2 +- README.md | 2 +- __tests__/fetch.test.ts | 21 ++++++++++++++++++--- src/fetch.ts | 19 +++++++++++++------ 5 files changed, 60 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7a4d5060c..65f534d00 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -23,7 +23,7 @@ jobs: persist-credentials: false - name: Fetch Data 📦 - uses: JamesIves/fetch-api-data-action@releases/v2 + uses: JamesIves/fetch-api-data-action@v2 with: endpoint: https://jsonplaceholder.typicode.com/todos/1 save-location: fetch-api-data-custom @@ -37,3 +37,29 @@ jobs: folder: fetch-api-data-custom target-folder: data ssh-key: ${{ secrets.DEPLOY_KEY }} + + refresh-api-data-modified-formatting-encoding: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2.4.0 + with: + persist-credentials: false + + - name: Fetch Data 📦 + uses: JamesIves/fetch-api-data-action@v2 + with: + endpoint: https://jsonplaceholder.typicode.com/todos/1 + save-location: fetch-api-data-custom-encoding + save-name: todo2 + encoding: hex + format: txt + retry: true + + - name: Build and Deploy Repo 🚀 + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + folder: fetch-api-data-custom-encoding + target-folder: encoding + ssh-key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 3e86f81ea..908d75e1d 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -10,4 +10,4 @@ jobs: name: Update Major Version Tag runs-on: ubuntu-latest steps: - - uses: nowactions/update-majorver@v1 + - uses: nowactions/update-majorver@v1.1.0 diff --git a/README.md b/README.md index 18bb2fa91..8b205fbb7 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ The following configuration options should be set. | `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** | | `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** | | `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** | -| `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 `hex`. Choose from `ascii` or `utf8` or `utf-8` or `utf16le` or `ucs2` or `ucs-2` or `base64` or `latin1` or `binary` or `hex` | `with` | **No** | +| `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** | | `debug` | If set to `true` the action will log the API responses it receives in the terminal. | `with` | **No** | --- diff --git a/__tests__/fetch.test.ts b/__tests__/fetch.test.ts index a3c8fc173..a425d395a 100644 --- a/__tests__/fetch.test.ts +++ b/__tests__/fetch.test.ts @@ -54,7 +54,7 @@ describe('fetch', () => { }) } catch (error) { expect(error instanceof Error && error.message).toBe( - "There was an error fetching from the API: TypeError: Cannot read property 'cat' of null" + "There was an error fetching from the API: TypeError: Cannot read property 'cat' of null ❌" ) } }) @@ -77,7 +77,7 @@ describe('fetch', () => { }) } catch (error) { expect(error instanceof Error && error.message).toBe( - 'There was an error fetching from the API: Error: {"a":1}' + 'There was an error fetching from the API: Error: {"a":1} ❌' ) } }) @@ -101,7 +101,7 @@ describe('fetch', () => { }) } catch (error) { expect(error instanceof Error && error.message).toBe( - 'There was an error fetching from the API: FetchError: invalid json response body at https://jives.dev/ reason: Unexpected token < in JSON at position 0' + 'There was an error fetching from the API: FetchError: invalid json response body at https://jives.dev/ reason: Unexpected token < in JSON at position 0 ❌' ) } }) @@ -143,5 +143,20 @@ describe('fetch', () => { }) expect(process.env['fetch-api-data']).toBe('68656C6C6F21') }) + + it('should fail if invalid encoding is used', async () => { + try { + await generateExport({ + data: '68656C6C6F21', + encoding: 'hexxxxx' as BufferEncoding, + format: 'txt', + saveName: 'hex-data' + }) + } catch (error) { + expect(error instanceof Error && error.message).toBe( + `There was an error generating the export file: TypeError [ERR_INVALID_OPT_VALUE_ENCODING]: The value "hexxxxx" is invalid for option "encoding" ❌` + ) + } + }) }) }) diff --git a/src/fetch.ts b/src/fetch.ts index 810bdcaf5..7ff1c68da 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -58,7 +58,7 @@ export async function retrieveData({ } ) } catch (error) { - throw new Error(`There was an error fetching from the API: ${error}`) + throw new Error(`There was an error fetching from the API: ${error} ❌`) } } @@ -75,12 +75,19 @@ export async function generateExport({ saveName ? saveName : 'data' }.${format ? format : 'json'}` const dataEncoding = encoding ? encoding : 'utf8' - await mkdirP(`${saveLocation ? saveLocation : 'fetch-api-data-action'}`) - await fs.writeFile(file, data, dataEncoding) - info(`Saved ${file} 💾`) + try { + await mkdirP(`${saveLocation ? saveLocation : 'fetch-api-data-action'}`) + await fs.writeFile(file, data, dataEncoding) + + info(`Saved ${file} 💾`) - exportVariable('fetch-api-data', data) + exportVariable('fetch-api-data', data) - return Status.SUCCESS + return Status.SUCCESS + } catch (error) { + throw new Error( + `There was an error generating the export file: ${error} ❌` + ) + } }