Compare commits

...

176 Commits

Author SHA1 Message Date
James M. Greene
13b55b33dd Merge pull request #272 from kbdharun/main
chore/docs: update version, fix typos
2023-12-07 09:29:18 -06:00
K.B.Dharun Krishna
c284911fe1 chore/docs: update version, fix typos
Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2023-12-07 16:08:41 +05:30
James M. Greene
ae44070880 Merge pull request #266 from actions/dependabot/npm_and_yarn/eslint-8.55.0
Bump eslint from 8.54.0 to 8.55.0
2023-12-06 23:51:54 -06:00
dependabot[bot]
34a8f6066a Bump eslint from 8.54.0 to 8.55.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.54.0 to 8.55.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.54.0...v8.55.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 05:48:00 +00:00
James M. Greene
b65643c0ab Merge pull request #267 from actions/dependabot/npm_and_yarn/nock-13.4.0
Bump nock from 13.3.8 to 13.4.0
2023-12-06 23:46:31 -06:00
dependabot[bot]
faceed1585 Bump nock from 13.3.8 to 13.4.0
Bumps [nock](https://github.com/nock/nock) from 13.3.8 to 13.4.0.
- [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.3.8...v13.4.0)

---
updated-dependencies:
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 05:41:02 +00:00
James M. Greene
230466c706 Merge pull request #268 from actions/dependabot/npm_and_yarn/eslint-config-prettier-9.1.0
Bump eslint-config-prettier from 9.0.0 to 9.1.0
2023-12-06 23:39:43 -06:00
dependabot[bot]
38d34f8e6f Bump eslint-config-prettier from 9.0.0 to 9.1.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 9.0.0 to 9.1.0.
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v9.0.0...v9.1.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>
2023-12-06 21:30:21 +00:00
James M. Greene
cd33125d26 Merge pull request #269 from actions/dependabot/npm_and_yarn/actions/core-1.10.1
Bump @actions/core from 1.10.0 to 1.10.1
2023-12-06 15:29:03 -06:00
github-actions[bot]
dd970aea72 Update distributables after Dependabot 🤖 2023-12-06 21:02:33 +00:00
dependabot[bot]
7433d78cba Bump @actions/core from 1.10.0 to 1.10.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.10.0 to 1.10.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-06 21:02:09 +00:00
James M. Greene
56d63c68a6 Merge pull request #261 from actions/dependabot/npm_and_yarn/actions/github-6.0.0
Bump @actions/github from 5.1.1 to 6.0.0
2023-12-06 15:00:45 -06:00
James M. Greene
1050c5c646 Merge branch 'main' into dependabot/npm_and_yarn/actions/github-6.0.0 2023-12-06 14:57:16 -06:00
James M. Greene
f8e6f4a56d Fix formatting 2023-12-06 14:56:54 -06:00
James M. Greene
b687ea25c8 Fix last test failure 2023-12-06 14:51:36 -06:00
James M. Greene
ccfe503c3f Merge pull request #270 from actions/v3-readme
Update compatibility table for v3
2023-12-06 09:40:25 -06:00
James M. Greene
ed119588ad Stabilize some tests 2023-12-06 01:24:29 -06:00
James M. Greene
a53c6bc7f1 Update distributables 2023-12-06 01:07:52 -06:00
James M. Greene
cc18e529bf Update tests to use undici mocking for latest Octokit 2023-12-06 01:05:59 -06:00
James M. Greene
b751a79e06 Add undici as a devDep 2023-12-06 01:04:50 -06:00
James M. Greene
dda23d18e4 Update compatibility table for v3 2023-12-04 19:42:16 -06:00
James M. Greene
3430969625 Update .node-version 2023-12-03 00:01:26 -06:00
github-actions[bot]
6784dc0464 Update distributables after Dependabot 🤖 2023-12-03 05:44:47 +00:00
dependabot[bot]
89c47f5a13 Bump @actions/github from 5.1.1 to 6.0.0
Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 5.1.1 to 6.0.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-03 05:44:21 +00:00
James M. Greene
77d7344265 Merge pull request #256 from takost/update-to-node-20
Update action to node20
2023-12-02 23:42:58 -06:00
James M. Greene
84abb89dc5 Merge branch 'main' into update-to-node-20 2023-12-02 06:48:59 -06:00
James M. Greene
de14547edc Merge pull request #264 from actions/dependabot/npm_and_yarn/prettier-3.1.0
Bump prettier from 3.0.0 to 3.1.0
2023-11-29 15:31:50 -06:00
dependabot[bot]
ced2b1a16b Bump prettier from 3.0.0 to 3.1.0
Bumps [prettier](https://github.com/prettier/prettier) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.0.0...3.1.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-29 21:29:04 +00:00
James M. Greene
3a91181e1b Merge pull request #263 from actions/dependabot/npm_and_yarn/octokit/request-error-5.0.1
Bump @octokit/request-error from 5.0.0 to 5.0.1
2023-11-29 15:27:41 -06:00
dependabot[bot]
6fa14b662d Bump @octokit/request-error from 5.0.0 to 5.0.1
Bumps [@octokit/request-error](https://github.com/octokit/request-error.js) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/octokit/request-error.js/releases)
- [Commits](https://github.com/octokit/request-error.js/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: "@octokit/request-error"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-29 20:53:06 +00:00
James M. Greene
f9e640bce0 Merge pull request #262 from actions/dependabot/npm_and_yarn/actions/http-client-2.2.0
Bump @actions/http-client from 2.1.0 to 2.2.0
2023-11-29 14:23:58 -06:00
github-actions[bot]
3eefb79441 Update distributables after Dependabot 🤖 2023-11-29 16:44:57 +00:00
dependabot[bot]
971e36e6ad Bump @actions/http-client from 2.1.0 to 2.2.0
Bumps [@actions/http-client](https://github.com/actions/toolkit/tree/HEAD/packages/http-client) from 2.1.0 to 2.2.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/http-client/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/http-client)

---
updated-dependencies:
- dependency-name: "@actions/http-client"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-29 16:44:27 +00:00
James M. Greene
6abbee335a Merge pull request #260 from actions/dependabot/npm_and_yarn/vercel/ncc-0.38.1
Bump @vercel/ncc from 0.36.1 to 0.38.1
2023-11-29 10:42:46 -06:00
github-actions[bot]
e149aa9f91 Update distributables after Dependabot 🤖 2023-11-27 18:46:58 +00:00
dependabot[bot]
0077311596 Bump @vercel/ncc from 0.36.1 to 0.38.1
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.36.1 to 0.38.1.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.36.1...0.38.1)

---
updated-dependencies:
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 18:46:34 +00:00
James M. Greene
03b62d1911 Merge pull request #257 from actions/dependabot/npm_and_yarn/eslint-8.54.0
Bump eslint from 8.44.0 to 8.54.0
2023-11-20 15:22:31 -06:00
dependabot[bot]
ada3f9d061 Bump eslint from 8.44.0 to 8.54.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.44.0 to 8.54.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.44.0...v8.54.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 21:19:50 +00:00
James M. Greene
82b8ae3f91 Merge pull request #254 from actions/dependabot/npm_and_yarn/nock-13.3.8
Bump nock from 13.3.1 to 13.3.8
2023-11-20 15:18:37 -06:00
dependabot[bot]
d183a290bd Bump nock from 13.3.1 to 13.3.8
Bumps [nock](https://github.com/nock/nock) from 13.3.1 to 13.3.8.
- [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.3.1...v13.3.8)

---
updated-dependencies:
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 21:12:50 +00:00
James M. Greene
8c6ef3d8d5 Merge pull request #246 from actions/dependabot/github_actions/actions/setup-node-4
Bump actions/setup-node from 3 to 4
2023-11-20 15:11:20 -06:00
dependabot[bot]
5a0bbc6e7d Bump actions/setup-node from 3 to 4
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

---
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>
2023-11-20 21:09:55 +00:00
James M. Greene
49af2606ad Merge pull request #245 from actions/dependabot/github_actions/release-drafter/release-drafter-5.25.0
Bump release-drafter/release-drafter from 5.24.0 to 5.25.0
2023-11-20 15:08:45 -06:00
dependabot[bot]
8b1057e1ce Bump release-drafter/release-drafter from 5.24.0 to 5.25.0
Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 5.24.0 to 5.25.0.
- [Release notes](https://github.com/release-drafter/release-drafter/releases)
- [Commits](65c5fb495d...09c613e259)

---
updated-dependencies:
- dependency-name: release-drafter/release-drafter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 21:07:11 +00:00
James M. Greene
1f9a7ee304 Merge pull request #232 from actions/dependabot/npm_and_yarn/eslint-plugin-github-4.10.1
Bump eslint-plugin-github from 4.8.0 to 4.10.1
2023-11-20 15:03:58 -06:00
dependabot[bot]
3aff9369e6 Bump eslint-plugin-github from 4.8.0 to 4.10.1
Bumps [eslint-plugin-github](https://github.com/github/eslint-plugin-github) from 4.8.0 to 4.10.1.
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.8.0...v4.10.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 20:59:36 +00:00
James M. Greene
a3969a1774 Merge pull request #224 from actions/dependabot/npm_and_yarn/jest-29.7.0
Bump jest from 29.6.1 to 29.7.0
2023-11-20 14:58:19 -06:00
dependabot[bot]
d9c5ae4728 Bump jest from 29.6.1 to 29.7.0
Bumps [jest](https://github.com/jestjs/jest/tree/HEAD/packages/jest) from 29.6.1 to 29.7.0.
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v29.7.0/packages/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 20:41:05 +00:00
James M. Greene
94490d3099 Merge pull request #210 from actions/fix-comma
Fix cosmetic error by replacing comma with period
2023-11-20 14:36:48 -06:00
James M. Greene
b2f7f34415 Merge branch 'main' into fix-comma 2023-11-20 14:30:58 -06:00
James M. Greene
dc61a05a4c Merge pull request #220 from actions/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-11-20 14:26:13 -06:00
dependabot[bot]
57dcea9665 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 20:22:37 +00:00
James M. Greene
11d1068b0c Merge pull request #209 from actions/dependabot/npm_and_yarn/eslint-config-prettier-9.0.0
Bump eslint-config-prettier from 8.8.0 to 9.0.0
2023-11-20 14:21:21 -06:00
dependabot[bot]
641f4888c4 Bump eslint-config-prettier from 8.8.0 to 9.0.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.8.0 to 9.0.0.
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.8.0...v9.0.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 20:15:30 +00:00
Tatyana Kostromskaya
6c3eed1621 Update action to node20 2023-11-17 12:08:51 +00:00
James M. Greene
fa86ad3bc1 Merge pull request #243 from actions/definitely-not-beta
Remove "beta" disclaimer from README
2023-10-18 15:50:57 -05:00
James M. Greene
976abf18ca Remove "beta" disclaimer from README 2023-10-18 14:43:26 -05:00
James M. Greene
377be98d59 Fix cosmetic error by replacing comma with period 2023-08-09 16:02:32 -05:00
James M. Greene
9dbe382482 Merge pull request #201 from actions/update-compat-table
Update GHES compatibility table after verifying with `3.9.x`
2023-07-21 01:31:59 -05:00
James M. Greene
96a5bb957b Fix typo 2023-07-20 00:18:22 -05:00
James M. Greene
8458d4c873 Update GHES compatibility table after verifying with 3.9.x 2023-07-20 00:17:35 -05:00
James M. Greene
0fd60c869b Merge pull request #194 from actions/dependabot/npm_and_yarn/octokit/request-error-5.0.0
Bump @octokit/request-error from 4.0.1 to 5.0.0
2023-07-10 16:52:19 -05:00
dependabot[bot]
9f42854283 Bump @octokit/request-error from 4.0.1 to 5.0.0
Bumps [@octokit/request-error](https://github.com/octokit/request-error.js) from 4.0.1 to 5.0.0.
- [Release notes](https://github.com/octokit/request-error.js/releases)
- [Commits](https://github.com/octokit/request-error.js/compare/v4.0.1...v5.0.0)

---
updated-dependencies:
- dependency-name: "@octokit/request-error"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 21:49:41 +00:00
James M. Greene
935c3f915d Merge pull request #196 from actions/dependabot/npm_and_yarn/prettier-3.0.0
Bump prettier from 2.8.8 to 3.0.0
2023-07-10 16:48:29 -05:00
dependabot[bot]
9c31b72d4a Bump prettier from 2.8.8 to 3.0.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 21:38:04 +00:00
James M. Greene
2b0ca4a2d6 Merge pull request #195 from actions/dependabot/npm_and_yarn/jest-29.6.1
Bump jest from 29.5.0 to 29.6.1
2023-07-10 16:37:21 -05:00
dependabot[bot]
f7b0e1891f Bump jest from 29.5.0 to 29.6.1
Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 29.5.0 to 29.6.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.6.1/packages/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 21:35:26 +00:00
James M. Greene
8b4e85a223 Merge pull request #192 from actions/dependabot/github_actions/release-drafter/release-drafter-5.24.0
Bump release-drafter/release-drafter from 5.23.0 to 5.24.0
2023-07-10 16:24:53 -05:00
dependabot[bot]
cca68c9d4b Bump release-drafter/release-drafter from 5.23.0 to 5.24.0
Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 5.23.0 to 5.24.0.
- [Release notes](https://github.com/release-drafter/release-drafter/releases)
- [Commits](569eb7ee3a...65c5fb495d)

---
updated-dependencies:
- dependency-name: release-drafter/release-drafter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 21:22:30 +00:00
James M. Greene
73a7feb190 Merge pull request #191 from actions/dependabot/npm_and_yarn/eslint-8.44.0
Bump eslint from 8.42.0 to 8.44.0
2023-07-10 16:21:29 -05:00
dependabot[bot]
2457a7fc63 Bump eslint from 8.42.0 to 8.44.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.42.0 to 8.44.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.42.0...v8.44.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 21:11:29 +00:00
James M. Greene
a562022ed9 Merge pull request #197 from actions/break-the-circle
Remove circular JSON references for error debugging
2023-07-10 15:03:45 -05:00
James M. Greene
b865ababeb Remove circular JSON references for error debugging 2023-07-10 14:58:49 -05:00
Fabian Aguilar Gomez
12ab2b16cf Merge pull request #187 from actions/update-deploy-error-message
Add error message for file permissions
2023-06-16 13:38:01 -05:00
Fabian Aguilar Gomez
157c090d5a update dist 2023-06-16 15:41:51 +00:00
Fabian Aguilar Gomez
39bfa7a819 Update dist/index.js
Co-authored-by: Mingzi  <yimysty@github.com>
2023-06-16 10:38:43 -05:00
Fabian Aguilar Gomez
cdd88557f6 update index 2023-06-15 22:20:55 +00:00
Fabian Aguilar Gomez
9cf15d70b7 Update deployment.js 2023-06-15 16:57:51 -05:00
James M. Greene
80d8f1cab8 Merge pull request #182 from actions/dependabot/npm_and_yarn/octokit/request-error-4.0.1
Bump @octokit/request-error from 3.0.3 to 4.0.1
2023-06-12 15:55:45 -05:00
github-actions[bot]
ffdf102557 Update distributables after Dependabot 🤖 2023-06-07 16:16:20 +00:00
dependabot[bot]
a1b3914731 Bump @octokit/request-error from 3.0.3 to 4.0.1
Bumps [@octokit/request-error](https://github.com/octokit/request-error.js) from 3.0.3 to 4.0.1.
- [Release notes](https://github.com/octokit/request-error.js/releases)
- [Commits](https://github.com/octokit/request-error.js/compare/v3.0.3...v4.0.1)

---
updated-dependencies:
- dependency-name: "@octokit/request-error"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-07 16:14:11 +00:00
James M. Greene
ee48c7b82e Merge pull request #183 from actions/dependabot/npm_and_yarn/eslint-8.42.0
Bump eslint from 8.40.0 to 8.42.0
2023-06-06 09:53:14 -05:00
dependabot[bot]
d9731c4933 Bump eslint from 8.40.0 to 8.42.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.40.0 to 8.42.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.40.0...v8.42.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-06 14:51:05 +00:00
James M. Greene
90eb49531e Merge pull request #181 from actions/dependabot/npm_and_yarn/eslint-plugin-github-4.8.0
Bump eslint-plugin-github from 4.7.0 to 4.8.0
2023-06-06 09:50:26 -05:00
dependabot[bot]
27cfbcb894 Bump eslint-plugin-github from 4.7.0 to 4.8.0
Bumps [eslint-plugin-github](https://github.com/github/eslint-plugin-github) from 4.7.0 to 4.8.0.
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.7.0...v4.8.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-06 14:48:34 +00:00
James M. Greene
dc213a7f7d Merge pull request #177 from actions/artifact-size
Check artifact size and warn if too large
2023-06-06 09:47:49 -05:00
James M. Greene
fdbbcdba1c Update distributables (again) 2023-06-06 09:43:48 -05:00
James M. Greene
2c56c1e0f7 Tweak wording 2023-06-06 09:40:22 -05:00
Greta Parks
2fb2bbeb02 Check artifact size and warn if too large 2023-05-22 17:00:13 +00:00
James M. Greene
b580d214b4 Merge pull request #169 from actions/dependabot/npm_and_yarn/eslint-8.40.0
Bump eslint from 8.38.0 to 8.40.0
2023-05-16 12:16:29 -05:00
dependabot[bot]
19e3eb4e0c Bump eslint from 8.38.0 to 8.40.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.38.0 to 8.40.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.38.0...v8.40.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-16 17:12:07 +00:00
James M. Greene
e3fab2ac01 Merge pull request #167 from actions/dependabot/npm_and_yarn/nock-13.3.1
Bump nock from 13.3.0 to 13.3.1
2023-05-16 12:11:22 -05:00
dependabot[bot]
bc2634f423 Bump nock from 13.3.0 to 13.3.1
Bumps [nock](https://github.com/nock/nock) from 13.3.0 to 13.3.1.
- [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.3.0...v13.3.1)

---
updated-dependencies:
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-16 16:32:08 +00:00
James M. Greene
f4c31b94b1 Merge pull request #159 from actions/dependabot/npm_and_yarn/prettier-2.8.8
Bump prettier from 2.8.7 to 2.8.8
2023-05-16 11:30:50 -05:00
dependabot[bot]
af578d2e40 Bump prettier from 2.8.7 to 2.8.8
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.7 to 2.8.8.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.7...2.8.8)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-16 16:15:02 +00:00
James M. Greene
8492390532 Merge pull request #170 from actions/timeout-fix
Timeout fix
2023-05-16 11:00:14 -05:00
James M. Greene
2905629ea4 Merge branch 'main' into timeout-fix 2023-05-16 10:28:30 -05:00
James M. Greene
c9a8d971f4 Merge pull request #175 from actions/ghes-warning
Add a support note to the deployment creation error if using GHES
2023-05-16 10:27:08 -05:00
James M. Greene
ff6c51e54c Remove period to avoid messing up URL 2023-05-16 10:15:22 -05:00
James M. Greene
b26c4cb790 Add a support note to the deployment creation error if using GHES 2023-05-16 10:13:05 -05:00
James M. Greene
6b39486d2c Move compatibility table to a less prominent spot 2023-05-15 17:49:07 -05:00
James M. Greene
69cf9b75ca Merge pull request #173 from actions/compat-table
Add GHES compatibility table
2023-05-15 14:32:13 -05:00
James M. Greene
668cc2675f Add a horizontal rule for a visual break 2023-05-15 14:29:46 -05:00
James M. Greene
edaafab71f Add a compatibility note to the release notes generation template 2023-05-15 14:21:12 -05:00
James M. Greene
fb67d78c18 Add a compatibility table to the README 2023-05-15 14:16:47 -05:00
Greta Parks
21b085af5f little rename for nuance 2023-05-12 16:54:50 +00:00
Greta Parks
ccca7e9d96 Some fixes 2023-05-12 16:28:50 +00:00
Greta Parks
c02d64fe5c Revert "fix error count lies and clean up tests a bit"
This reverts commit 3e2c26d7d5.
2023-05-12 15:53:50 +00:00
Greta Parks
dcb366ca66 Update src/internal/deployment.js
Co-authored-by: James M. Greene <JamesMGreene@github.com>
2023-05-12 09:40:31 -06:00
Greta Parks
3e2c26d7d5 fix error count lies and clean up tests a bit 2023-05-11 20:38:18 +00:00
Greta Parks
054faf7e6d enforce a max timeout 2023-05-11 18:39:06 +00:00
Greta Parks
bacaae7379 add warning and test for timeout over maximum 2023-05-09 21:26:22 +00:00
James M. Greene
af48cf94a4 Merge pull request #156 from actions/deprecation-cleanup
Remove deprecated input parameters
2023-04-18 09:59:28 -05:00
James M. Greene
b39c421b98 Remove deprecated input parameters 2023-04-18 01:13:17 -05:00
James M. Greene
176fcdbd0d Merge pull request #155 from actions/classic-grantbirki-driveby
General Repository Improvements
2023-04-18 00:43:13 -05:00
James M. Greene
b8a0d0233e Alphabetize the npm scripts 2023-04-18 00:34:47 -05:00
James M. Greene
31bb4568ea Move coverage badge to root directory 2023-04-18 00:32:50 -05:00
James M. Greene
6657d340c9 Rename 'functions' directory to 'internal' 2023-04-18 00:32:13 -05:00
James M. Greene
efce2761be Revert Actions workflow names since we're overriding in badges 2023-04-18 00:18:00 -05:00
James M. Greene
c77de140c8 Use shields.io for more consistent badges 2023-04-18 00:15:14 -05:00
James M. Greene
0a6b5a09eb Add badge for latest release 2023-04-18 00:04:23 -05:00
James M. Greene
ddf1436b98 Reorder badges 2023-04-17 23:57:32 -05:00
James M. Greene
b463fdb52c Shorten workflow names for better badges 2023-04-17 23:54:37 -05:00
James M. Greene
26c37d6a64 Wording tweak 2023-04-17 23:51:57 -05:00
James M. Greene
16c932f680 Update contribution instructions 2023-04-17 23:51:13 -05:00
James M. Greene
e93f066622 Use real version tag in example usage 2023-04-17 23:41:47 -05:00
James M. Greene
0d1bd15af6 Minor wording update in README 2023-04-17 23:37:32 -05:00
James M. Greene
5aacbeac9b Update README with info on Environment Variables set 2023-04-17 23:35:32 -05:00
James M. Greene
3a8a04e5ad Pin release-drafter action usage since we cannot trust outside orgs 2023-04-17 23:29:20 -05:00
James M. Greene
324f764c2b Unpin actions usage since we trust our own org 2023-04-17 23:27:04 -05:00
James M. Greene
5daf42835f Tidy up comment so Dependabot can update it 2023-04-17 23:26:12 -05:00
James M. Greene
dab0b0f83d Remove unnecessary checkout from release drafting workflow 2023-04-17 23:24:42 -05:00
James M. Greene
a8b1dc44fa Actions naming cleanup/reverts 2023-04-17 23:24:24 -05:00
James M. Greene
20bd69d98b Remove 'ci-test' script in favor of generating coverage badges as part of the 'all' script 2023-04-17 23:18:55 -05:00
James M. Greene
f7c37e718b Remove .eslintignore file in favor of existing .eslintrc.json ignore patterns 2023-04-17 23:17:34 -05:00
James M. Greene
425b204f49 Use node-version-file parameter instead of an extra step 2023-04-14 15:52:00 -05:00
grantbirki
9c5eb6975b remove required test coverage section 2023-04-14 21:32:12 +01:00
grantbirki
c667db85ec bundle 2023-04-14 21:29:15 +01:00
grantbirki
c05cd8b1e8 at least 70% coverage 2023-04-14 21:29:12 +01:00
grantbirki
571bf8a87f catches an error when trying to cancel a deployment - test 2023-04-14 21:26:09 +01:00
grantbirki
36f9337a64 test early exit on a deployment cancel request 2023-04-14 21:20:52 +01:00
grantbirki
c38b3699e6 exits early when deployment is not in progress - test 2023-04-14 21:10:57 +01:00
grantbirki
44c5eaa46e add check when no deployment is found 2023-04-14 21:04:16 +01:00
grantbirki
7b5216ce57 bundle and fmt 2023-04-14 21:01:12 +01:00
grantbirki
5f3aba0651 reduce passing coverage while writing tests 2023-04-14 20:59:23 +01:00
grantbirki
3194543231 update tests 2023-04-14 20:58:13 +01:00
grantbirki
515e39edbf structuring tests and functions 2023-04-14 20:43:44 +01:00
grantbirki
dbac87a7c1 new lines 2023-04-13 23:34:29 +01:00
grantbirki
f0789de653 structure readme 2023-04-13 23:26:36 +01:00
grantbirki
b98f9c9766 add inputs and outputs to the readme 2023-04-13 23:23:56 +01:00
grantbirki
54f29598ff npm update all the things 2023-04-13 23:17:15 +01:00
grantbirki
adb13af2ed add coverage badge to readme 2023-04-13 23:13:38 +01:00
grantbirki
68c51d2103 write coverage badge 2023-04-13 23:12:57 +01:00
grantbirki
c21c0b1aa2 enforce 100% test coverage 2023-04-13 23:11:46 +01:00
grantbirki
f28358b33b update ci-test and jest 2023-04-13 23:10:02 +01:00
grantbirki
f5eb43ca84 update readme 2023-04-13 23:08:45 +01:00
grantbirki
ddc80bafdb add a CONTRIBUTING file 2023-04-13 23:01:41 +01:00
grantbirki
f1d846dabc move test file 2023-04-13 22:59:58 +01:00
grantbirki
174365715e init the coverage badge 2023-04-13 22:58:09 +01:00
grantbirki
215f5a3008 update all workflow files to use the .node-version file in the root of the repo 2023-04-13 22:57:59 +01:00
grantbirki
ff86b6ce87 update version in package file 2023-04-13 22:57:36 +01:00
grantbirki
79773139e9 add new root level files 2023-04-13 22:57:24 +01:00
grantbirki
aaa3e0131c remove duplicate CODEOWNERS file 2023-04-13 22:51:51 +01:00
James M. Greene
f81ad71d2e Merge pull request #150 from actions/dependabot/npm_and_yarn/prettier-2.8.7
Bump prettier from 2.8.6 to 2.8.7
2023-03-31 22:15:26 -05:00
dependabot[bot]
adbdac1229 Bump prettier from 2.8.6 to 2.8.7
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.6 to 2.8.7.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.6...2.8.7)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-01 03:12:58 +00:00
James M. Greene
c124166064 Merge pull request #149 from actions/dependabot/npm_and_yarn/eslint-plugin-github-4.7.0
Bump eslint-plugin-github from 4.6.1 to 4.7.0
2023-03-31 22:11:04 -05:00
dependabot[bot]
d4e8b127fc Bump eslint-plugin-github from 4.6.1 to 4.7.0
Bumps [eslint-plugin-github](https://github.com/github/eslint-plugin-github) from 4.6.1 to 4.7.0.
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.6.1...v4.7.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 19:03:30 +00:00
James M. Greene
777703e175 Merge pull request #147 from actions/dependabot/npm_and_yarn/prettier-2.8.6
Bump prettier from 2.8.4 to 2.8.6
2023-03-22 15:55:56 -05:00
dependabot[bot]
34029d15d3 Bump prettier from 2.8.4 to 2.8.6
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.4 to 2.8.6.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.4...2.8.6)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-22 20:55:16 +00:00
James M. Greene
4cc630477b Merge pull request #142 from actions/dependabot/npm_and_yarn/eslint-config-prettier-8.8.0
Bump eslint-config-prettier from 8.7.0 to 8.8.0
2023-03-22 15:53:52 -05:00
dependabot[bot]
9f07c73fa5 Bump eslint-config-prettier from 8.7.0 to 8.8.0
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.7.0 to 8.8.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.7.0...v8.8.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>
2023-03-22 20:53:15 +00:00
James M. Greene
6ff0b5a17e Merge pull request #103 from actions/dependabot/npm_and_yarn/vercel/ncc-0.36.1
Bump @vercel/ncc from 0.31.1 to 0.36.1
2023-03-22 15:33:21 -05:00
github-actions[bot]
703ddcc7b8 Update distributables after Dependabot 🤖 2023-03-21 03:47:19 +00:00
dependabot[bot]
ca55b66fad Bump @vercel/ncc from 0.31.1 to 0.36.1
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.31.1 to 0.36.1.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.31.1...0.36.1)

---
updated-dependencies:
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-21 03:46:47 +00:00
James M. Greene
73e62e6511 Merge pull request #140 from actions/cut-v2
Update the deployment API endpoints used by the api-client module
2023-03-17 11:59:36 -05:00
Jess Bees
b254707f5c Update the deployment API endpoints used by the api-client module 2023-03-17 11:54:20 -05:00
30 changed files with 53386 additions and 8925 deletions

View File

@@ -13,5 +13,5 @@
"rules": {
"semi": ["error", "never"]
},
"ignorePatterns": ["/dist/", "/pre/"]
"ignorePatterns": ["/dist/"]
}

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
dist/** -diff linguist-generated=true

View File

@@ -6,7 +6,11 @@ template: |
$CHANGES
---
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
:warning: For use with products other than GitHub.com, such as GitHub Enterprise Server, please consult the [compatibility table](https://github.com/$OWNER/$REPOSITORY/#compatibilty).
categories:
- title: '🚀 Features'
labels:

View File

@@ -21,12 +21,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Set Node.js 16.x
uses: actions/setup-node@v3
- name: Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version-file: '.node-version'
cache: npm
- name: Install dependencies
@@ -36,9 +37,17 @@ jobs:
run: npm run prepare
- name: Compare the expected and actual dist/ directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build in dist folder. See status below:"
git diff
exit 1
fi
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@@ -1,4 +1,4 @@
name: Checking formatting
name: Check formatting
on:
push:
@@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.JS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'npm'
node-version-file: '.node-version'
cache: npm
- name: Install dependencies
run: npm ci

View File

@@ -1,4 +1,4 @@
name: Check linter
name: Check linting
on:
push:
@@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.JS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'npm'
node-version-file: '.node-version'
cache: npm
- name: Install dependencies
run: npm ci

View File

@@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'
name: CodeQL
on:
push:
@@ -37,8 +37,8 @@ jobs:
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -11,7 +11,6 @@ jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.25.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,15 +22,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAGES_AUTOMATION_PAT }}
- name: Setup Node.JS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'npm'
node-version-file: '.node-version'
cache: npm
- name: Install dependencies
run: npm ci

View File

@@ -1,4 +1,4 @@
name: Run Tests
name: Run tests
on:
push:
@@ -14,13 +14,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.JS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'npm'
node-version-file: '.node-version'
cache: npm
- name: Install dependencies
run: npm ci

2
.gitignore vendored
View File

@@ -64,4 +64,4 @@ typings/
.env
# next.js build output
.next
.next

1
.node-version Normal file
View File

@@ -0,0 +1 @@
20.10.0

View File

@@ -1 +0,0 @@
* @actions/pages

29
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,29 @@
# Contributing 💻
All contributions are welcome and greatly appreciated!
## Steps to Contribute 💡
> Check the `.node-version` file in the root of this repo so see what version of Node.js is required for local development - note, this can be different from the version of Node.js which runs the Action on GitHub runners. It is suggested to download [nodenv](https://github.com/nodenv/nodenv) which uses this file and manages your Node.js versions for you
1. Fork this repository
2. Make your changes
3. [Test](#testing-) your changes locally
4. Before opening a pull request, please run `npm run all` to verify formatting, linting, tests, generated files, etc.
5. Commit and push your changes to your fork
6. Open a pull request back to this repository
7. Wait for an approval or changes requested from the maintainers of this repository
After merging the pull request, the maintainers of this repository will create a new release with those changes included. After that, everyone can utilize the newly integrated changes in their own Actions workflows and enjoy your awesome improvements!
## Testing 🧪
### Running the test suite (required)
Simply run the following command to execute the entire test suite:
```bash
npm test
```
> Note: This requires that you have already run `npm install`.

View File

@@ -1,10 +1,8 @@
# deploy-pages
# deploy-pages 🚀
This action is used to deploy [Actions artifacts][artifacts] to GitHub Pages.
[![Release](https://img.shields.io/github/v/release/actions/deploy-pages?label=Release&logo=github)](https://github.com/actions/deploy-pages/releases/latest) [![Linting](https://img.shields.io/github/actions/workflow/status/actions/deploy-pages/check-linter.yml?label=Linting&logo=github)](https://github.com/actions/deploy-pages/actions/workflows/check-linter.yml) [![Formatting](https://img.shields.io/github/actions/workflow/status/actions/deploy-pages/check-formatting.yml?label=Formatting&logo=github)](https://github.com/actions/deploy-pages/actions/workflows/check-formatting.yml) [![Tests](https://img.shields.io/github/actions/workflow/status/actions/deploy-pages/test.yml?label=Tests&logo=github)](https://github.com/actions/deploy-pages/actions/workflows/test.yml) ![Coverage](./coverage_badge.svg) [![Distributables](https://img.shields.io/github/actions/workflow/status/actions/deploy-pages/check-dist.yml?label=Distributables&logo=github)](https://github.com/actions/deploy-pages/actions/workflows/check-dist.yml) [![CodeQL](https://img.shields.io/github/actions/workflow/status/actions/deploy-pages/codeql-analysis.yml?label=CodeQL&logo=github)](https://github.com/actions/deploy-pages/actions/workflows/codeql-analysis.yml)
## Scope
⚠️ Official support for building Pages with Actions is in public beta at the moment.
This action is used to deploy [Actions artifacts][artifacts] to [GitHub Pages](https://pages.github.com/).
## Usage
@@ -12,7 +10,7 @@ See [action.yml](action.yml) for the various `inputs` this action supports.
For examples that make use of this action, check out our [starter-workflows][starter-workflows] in a variety of frameworks.
This action expects an artifact named `github-pages` to have been created prior to execution. This is done automatically using [`actions/upload-pages-artifact`][upload-pages-artifact].
This action expects an artifact named `github-pages` to have been created prior to execution. This is done automatically when using [`actions/upload-pages-artifact`][upload-pages-artifact].
We recommend this action to be used in a dedicated job:
@@ -43,10 +41,33 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v3 # or specific "vX.X.X" version tag for this action
```
## Security considerations
### Inputs 📥
| Input | Required? | Default | Description |
| ----- | --------- | ------- | ----------- |
| `token` | `true` | `${{ github.token }}` | The GitHub token used to create an authenticated client - Provided for you by default! |
| `timeout` | `false` | `"600000"` | Time in milliseconds after which to timeout and cancel the deployment (default: 10 minutes) |
| `error_count` | `false` | `"10"` | Maximum number of status report errors before cancelling a deployment (default: 10) |
| `reporting_interval` | `false` | `"5000"` | Time in milliseconds between two deployment status reports (default: 5 seconds) |
| `artifact_name` | `false` | `"github-pages"` | The name of the artifact to deploy |
| `preview` | `false` | `"false"` | Is this attempting to deploy a pull request as a GitHub Pages preview site? (NOTE: This feature is only in alpha currently and is not available to the public!) |
### Outputs 📤
| Output | Description |
| ------ | ----------- |
| `page_url` | The URL of the deployed Pages site |
### Environment Variables 🌎
| Variable | Description |
| -------- | ----------- |
| `GITHUB_PAGES` | This environment variable is created and set to the string value `"true"` so that framework build tools may choose to differentiate their output based on the intended target hosting platform. |
## Security Considerations
There are a few important considerations to be aware of:
@@ -60,9 +81,25 @@ There are a few important considerations to be aware of:
4. If your Pages site is using a source branch, the deployment must originate from this source branch unless [your environment is protected][environment-protection] in which case the environment protection rules take precedence over the source branch rule
5. If your Pages site is using GitHub Actions as the source, while not required we highly recommend you also [protect your environment][environment-protection] (we do it by default for you)
5. If your Pages site is using GitHub Actions as the source, while not required we highly recommend you also [protect your environment][environment-protection] (we will configure it by default for you).
# Release instructions
## Compatibility
This action is primarily designed for use with GitHub.com's Actions workflows and Pages deployments. However, certain releases should also be compatible with GitHub Enterprise Server (GHES) `3.7` and above.
| Release | GHES Compatibility |
|:---|:---|
| [`v3`](https://github.com/actions/deploy-pages/releases/tag/v3) | `>= 3.9` |
| `v3.x.x` | `>= 3.9` |
| [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | `>= 3.9` |
| `v2.x.x` | `>= 3.9` |
| [`v1`](https://github.com/actions/deploy-pages/releases/tag/v1) | `>= 3.7` |
| [`v1.2.8`](https://github.com/actions/deploy-pages/releases/tag/v1.2.8) | `>= 3.7` |
| [`v1.2.7`](https://github.com/actions/deploy-pages/releases/tag/v1.2.7) | :warning: `>= 3.9` [Incompatible with prior versions!](https://github.com/actions/deploy-pages/issues/137) |
| [`v1.2.6`](https://github.com/actions/deploy-pages/releases/tag/v1.2.6) | `>= 3.7` |
| `v1.x.x` | `>= 3.7` |
## Release Instructions
In order to release a new version of this Action:
@@ -70,7 +107,7 @@ In order to release a new version of this Action:
2. Publish the draft release from the `main` branch with semantic version as the tag name, _with_ the checkbox to publish to the GitHub Marketplace checked. :ballot_box_with_check:
3. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding the major version tag such as `v1`.
3. After publishing the release, the [`release` workflow][release] will automatically run to create/update the corresponding major version tag such as `v1`.
⚠️ Environment approval is required. Check the [Release workflow run list][release-workflow-runs].

View File

@@ -2,18 +2,9 @@ name: 'Deploy GitHub Pages site'
description: 'A GitHub Action to deploy an artifact as a GitHub Pages site'
author: 'GitHub'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
inputs:
emit_telemetry:
deprecationMessage: 'Use of this input causes the action to do nothing. You should remove this build step from your workflow.'
description: 'Should this action only emit build telemetry instead of deploying the build artifact?'
required: false
default: 'false'
conclusion:
deprecationMessage: 'Use of this input does nothing as it was part of the deprecated `emit_telemetry` flow. You should remove this parameter from your workflow.'
description: 'The status of the previous build.'
required: false
token:
description: 'GitHub token'
default: ${{ github.token }}

1
coverage_badge.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 81.39%"><title>Coverage: 81.39%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#dfb317"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">81.39%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">81.39%</text></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

54148
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

152
dist/licenses.txt generated vendored
View File

@@ -47,6 +47,28 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
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.
@octokit/auth-token
MIT
The MIT License
@@ -219,16 +241,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@vercel/ncc
MIT
Copyright 2018 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.
before-after-hook
Apache-2.0
Apache License
@@ -455,57 +467,6 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
http-status-messages
is-plain-object
MIT
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
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.
node-fetch
MIT
The MIT License (MIT)
Copyright (c) 2016 David Frank
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.
once
ISC
The ISC License
@@ -525,9 +486,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
tr46
MIT
tunnel
MIT
The MIT License (MIT)
@@ -553,6 +511,31 @@ 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.
universal-user-agent
ISC
# [ISC License](https://spdx.org/licenses/ISC)
@@ -577,47 +560,6 @@ The above copyright notice and this permission notice shall be included in all c
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.
webidl-conversions
BSD-2-Clause
# The BSD 2-Clause License
Copyright (c) 2014, Domenic Denicola
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
whatwg-url
MIT
The MIT License (MIT)
Copyright (c) 20152016 Sebastian Mayr
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.
wrappy
ISC
The ISC License

2
dist/sourcemap-register.js generated vendored

File diff suppressed because one or more lines are too long

6374
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +1,29 @@
{
"name": "deploy-pages",
"version": "0.0.1",
"version": "0.0.0",
"description": "Deploy an actions artifact to GitHub Pages",
"main": "./dist/index.js",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@actions/http-client": "^2.1.0",
"@octokit/request-error": "^3.0.3",
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@actions/http-client": "^2.2.0",
"@octokit/request-error": "^5.0.1",
"http-status-messages": "^1.1.0"
},
"devDependencies": {
"@vercel/ncc": "^0.31.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-github": "^4.6.1",
"jest": "^29.5.0",
"nock": "^13.3.0",
"prettier": "^2.8.4"
"@vercel/ncc": "^0.38.1",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-github": "^4.10.1",
"jest": "^29.7.0",
"make-coverage-badge": "^1.2.0",
"nock": "^13.4.0",
"prettier": "^3.1.0",
"undici": "^6.0.0"
},
"scripts": {
"all": "npm run format && npm run lint && npm run prepare && npm run test",
"all": "npm run format && npm run lint && npm run prepare && npm run test && npm run coverage-badge",
"coverage-badge": "make-coverage-badge --output-path ./coverage_badge.svg",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "DEBUG=eslint:cli-engine eslint --fix .",
@@ -41,5 +44,22 @@
"bugs": {
"url": "https://github.com/actions/deploy-pages/issues"
},
"homepage": "https://github.com/actions/deploy-pages#readme"
"homepage": "https://github.com/actions/deploy-pages#readme",
"jest": {
"coverageReporters": [
"json-summary",
"text",
"lcov"
],
"collectCoverage": true,
"collectCoverageFrom": [
"./src/**"
],
"coverageThreshold": {
"global": {
"lines": 70,
"statements": 70
}
}
}
}

View File

@@ -0,0 +1,38 @@
const process = require('process')
const cp = require('child_process')
const path = require('path')
describe('with all environment variables set', () => {
beforeEach(() => {
process.env.ACTIONS_RUNTIME_URL = 'http://my-url'
process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
process.env.GITHUB_TOKEN = 'gha-token'
process.env.GITHUB_SHA = '123abc'
process.env.GITHUB_ACTOR = 'monalisa'
process.env.GITHUB_ACTION = '__monalisa/octocat'
process.env.GITHUB_ACTION_PATH = 'something'
})
it('executes cleanly', done => {
const ip = path.join(__dirname, '../index.js')
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
expect(stdout).toMatch(/::debug::all variables are set/)
done()
})
})
})
describe('with variables missing', () => {
it('execution fails if there are missing variables', done => {
delete process.env.ACTIONS_RUNTIME_URL
const ip = path.join(__dirname, '../index.js')
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
expect(stdout).toBe('')
expect(err).toBeTruthy()
expect(err.code).toBe(1)
done()
})
})
})

View File

@@ -0,0 +1,977 @@
const core = require('@actions/core')
// For mocking network calls with core http (http-client)
const nock = require('nock')
// For mocking network calls with native Fetch (octokit)
const { MockAgent, setGlobalDispatcher } = require('undici')
const { Deployment, MAX_TIMEOUT, ONE_GIGABYTE, SIZE_LIMIT_DESCRIPTION } = require('../../internal/deployment')
const fakeJwt =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
describe('Deployment', () => {
let mockPool
beforeEach(() => {
jest.clearAllMocks()
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
process.env.GITHUB_TOKEN = 'gha-token'
process.env.GITHUB_SHA = '123abc'
process.env.GITHUB_ACTOR = 'monalisa'
process.env.GITHUB_ACTION = '__monalisa/octocat'
process.env.GITHUB_ACTION_PATH = 'something'
jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) {
case 'artifact_name':
return 'github-pages'
case 'token':
return process.env.GITHUB_TOKEN
case 'reporting_interval':
return 50 // Lower reporting interval to speed up test
default:
return process.env[`INPUT_${param.toUpperCase()}`] || ''
}
})
jest.spyOn(core, 'setOutput').mockImplementation(param => {
return param
})
jest.spyOn(core, 'setFailed').mockImplementation(param => {
return param
})
// Mock error/warning/info/debug
jest.spyOn(core, 'error').mockImplementation(jest.fn())
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
jest.spyOn(core, 'info').mockImplementation(jest.fn())
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
// Set up Fetch mocking
const mockAgent = new MockAgent()
mockAgent.disableNetConnect()
setGlobalDispatcher(mockAgent)
mockPool = mockAgent.get('https://api.github.com')
})
describe('#create', () => {
afterEach(() => {
// Remove mock for `core.getInput('preview')`
delete process.env.INPUT_PREVIEW
})
it('can successfully create a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.pages_build_version === process.env.GITHUB_SHA &&
body.oidc_token === fakeJwt
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
expect(core.setFailed).not.toHaveBeenCalled()
expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
)
artifactExchangeScope.done()
})
it('can successfully create a preview deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 4 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
keys[3] === 'preview' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.pages_build_version === process.env.GITHUB_SHA &&
body.oidc_token === fakeJwt &&
body.preview === true
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome',
preview_url: 'https://actions.drafts.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Return `"true"` for `core.getInput("preview")`
process.env.INPUT_PREVIEW = 'true'
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
expect(core.setFailed).not.toHaveBeenCalled()
expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
)
artifactExchangeScope.done()
})
it('reports errors with failed artifact exchange', async () => {
process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(400, {})
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad Request`
)
)
artifactExchangeScope.done()
})
it('reports errors with a failed 500 in a deployment', async () => {
process.env.GITHUB_SHA = 'build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 2 &&
keys[0] === 'artifact_url' &&
keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(500, { message: 'oh no' }, { headers: { 'content-type': 'application/json' } })
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 500) with build version ${process.env.GITHUB_SHA}. Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.`
)
)
artifactExchangeScope.done()
})
it('reports errors with an unexpected 403 during deployment', async () => {
process.env.GITHUB_SHA = 'build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 2 &&
keys[0] === 'artifact_url' &&
keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(403, { message: 'You are forbidden' }, { headers: { 'content-type': 'application/json' } })
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 403) with build version ${process.env.GITHUB_SHA}. Ensure GITHUB_TOKEN has permission "pages: write".`
)
)
artifactExchangeScope.done()
})
it('reports errors with an unexpected 404 during deployment', async () => {
process.env.GITHUB_SHA = 'build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 2 &&
keys[0] === 'artifact_url' &&
keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(404, { message: 'Not found' }, { headers: { 'content-type': 'application/json' } })
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 404) with build version ${process.env.GITHUB_SHA}. Ensure GitHub Pages has been enabled: https://github.com/actions/is-awesome/settings/pages`
)
)
artifactExchangeScope.done()
})
it('reports errors with failed deployments', async () => {
process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 2 &&
keys[0] === 'artifact_url' &&
keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(400, { message: 'Bad request' }, { headers: { 'content-type': 'application/json' } })
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad request`
)
)
artifactExchangeScope.done()
})
it('warns if the artifact size is bigger than maximum', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactSize = ONE_GIGABYTE + 1
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://fake-artifact.com', name: 'github-pages', size: `${artifactSize}` },
{ url: 'https://another-artifact.com', name: 'another-artifact' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
const deployment = new Deployment()
await deployment.create(fakeJwt)
expect(core.warning).toBeCalledWith(
`Uploaded artifact size of ${artifactSize} bytes exceeds the allowed size of ${SIZE_LIMIT_DESCRIPTION}. Deployment might fail.`
)
expect(core.setFailed).not.toHaveBeenCalled()
expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
)
artifactExchangeScope.done()
})
it('warns when the timeout is greater than the maximum allowed', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Set timeout to greater than max
jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) {
case 'artifact_name':
return 'github-pages'
case 'token':
return process.env.GITHUB_TOKEN
case 'reporting_interval':
return 50 // Lower reporting interval to speed up test
case 'timeout':
return MAX_TIMEOUT + 1
default:
return process.env[`INPUT_${param.toUpperCase()}`] || ''
}
})
const deployment = new Deployment()
await deployment.create(fakeJwt)
expect(core.warning).toBeCalledWith(
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
)
artifactExchangeScope.done()
})
})
describe('#check', () => {
it('sets output to success when deployment is successful', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
method: 'GET'
})
.reply(200, { status: 'succeed' }, { headers: { 'content-type': 'application/json' } })
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
await deployment.check()
expect(core.setOutput).toBeCalledWith('status', 'succeed')
expect(core.info).toHaveBeenLastCalledWith('Reported success!')
artifactExchangeScope.done()
})
it('fails check when no deployment is found', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const deployment = new Deployment()
await deployment.check()
expect(core.setFailed).toBeCalledWith('Deployment not found.')
})
it('exits early when deployment is not in progress', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
const deployment = new Deployment()
await deployment.create(fakeJwt)
deployment.deploymentInfo.pending = false
await deployment.check()
expect(core.setFailed).toBeCalledWith('Unable to get deployment status.')
artifactExchangeScope.done()
})
it('enforces max timeout', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
method: 'GET'
})
.reply(200, { status: 'deployment_in_progress' }, { headers: { 'content-type': 'application/json' } })
.times(2)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
method: 'POST'
})
.reply(200, {}, { headers: { 'content-type': 'application/json' } })
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Set timeout to greater than max
jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) {
case 'artifact_name':
return 'github-pages'
case 'token':
return process.env.GITHUB_TOKEN
case 'error_count':
return 10
case 'reporting_interval':
return 50 // Lower the interval for the test
case 'timeout':
return MAX_TIMEOUT + 1
default:
return process.env[`INPUT_${param.toUpperCase()}`] || ''
}
})
// Jump the "current time" by MAX_TIMEOUT ever time Date.now is called
const _now = Date.now
let nowCalls = 0
const nowSpy = jest.spyOn(Date, 'now').mockImplementation(() => {
nowCalls++
return _now() + MAX_TIMEOUT * nowCalls
})
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
await deployment.check()
nowSpy.mockRestore()
expect(deployment.timeout).toEqual(MAX_TIMEOUT)
expect(core.error).toBeCalledWith('Timeout reached, aborting!')
expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!')
artifactExchangeScope.done()
})
it('sets timeout to user timeout if user timeout is less than max timeout', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
method: 'POST'
})
.reply(200, {}, { headers: { 'content-type': 'application/json' } })
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Set timeout to greater than max
jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) {
case 'artifact_name':
return 'github-pages'
case 'token':
return process.env.GITHUB_TOKEN
case 'error_count':
return 10
case 'reporting_interval':
return 42 // The default of 5000 is too long for the test
case 'timeout':
return 42
default:
return process.env[`INPUT_${param.toUpperCase()}`] || ''
}
})
const now = Date.now()
const mockStartTime = now - 42
jest
.spyOn(Date, 'now')
.mockImplementationOnce(() => mockStartTime)
.mockImplementationOnce(() => now)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
await deployment.check()
expect(deployment.timeout).toEqual(42)
expect(core.error).toBeCalledWith('Timeout reached, aborting!')
expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!')
artifactExchangeScope.done()
})
it('sets output to success when timeout is set but not reached', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
method: 'GET'
})
.reply(200, { status: 'succeed' }, { headers: { 'content-type': 'application/json' } })
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Set timeout to greater than max
jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) {
case 'artifact_name':
return 'github-pages'
case 'token':
return process.env.GITHUB_TOKEN
case 'error_count':
return 10
case 'reporting_interval':
return 0 // The default of 5000 is too long for the test
case 'timeout':
return 42
default:
return process.env[`INPUT_${param.toUpperCase()}`] || ''
}
})
const now = Date.now()
const mockStartTime = now // No time elapsed
jest
.spyOn(Date, 'now')
.mockImplementationOnce(() => mockStartTime)
.mockImplementationOnce(() => now)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
await deployment.check()
expect(deployment.timeout).toEqual(42)
expect(core.error).not.toBeCalled()
expect(core.setOutput).toBeCalledWith('status', 'succeed')
expect(core.info).toHaveBeenLastCalledWith('Reported success!')
artifactExchangeScope.done()
})
})
describe('#cancel', () => {
it('can successfully cancel a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
method: 'POST'
})
.reply(200, {}, { headers: { 'content-type': 'application/json' } })
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
// Cancel it
await deployment.cancel()
expect(core.info).toHaveBeenLastCalledWith(`Canceled deployment with ID ${process.env.GITHUB_SHA}`)
artifactExchangeScope.done()
})
it('can exit if a pages deployment was not created and none need to be cancelled', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
// Create the deployment
const deployment = new Deployment()
// Cancel it
await deployment.cancel()
expect(core.debug).toHaveBeenCalledWith('all variables are set')
expect(core.debug).toHaveBeenCalledWith(`No deployment to cancel`)
})
it('catches an error when trying to cancel a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`,
method: 'POST',
body: bodyString => {
const body = JSON.parse(bodyString)
const keys = Object.keys(body).sort()
return (
keys.length === 3 &&
keys[0] === 'artifact_url' &&
keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' &&
body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA
)
}
})
.reply(
200,
{
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool
.intercept({
path: `/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}/cancel`,
method: 'POST'
})
.reply(500, {}, { headers: { 'content-type': 'application/json' } })
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
// Cancel it
await deployment.cancel()
expect(core.error).toHaveBeenCalledWith(`Canceling Pages deployment failed`, expect.anything())
artifactExchangeScope.done()
})
})
})

View File

@@ -4,8 +4,8 @@
const core = require('@actions/core')
const { Deployment } = require('./deployment')
const getContext = require('./context')
const { Deployment } = require('./internal/deployment')
const getContext = require('./internal/context')
const deployment = new Deployment()
@@ -48,9 +48,4 @@ process.on('SIGINT', cancelHandler)
process.on('SIGTERM', cancelHandler)
// Main
const emitTelemetry = core.getInput('emit_telemetry')
if (emitTelemetry === 'true') {
// For compatibility, treat the use of this deprecated input as a no-op
} else {
main()
}
main()

View File

@@ -1,312 +0,0 @@
const core = require('@actions/core')
const process = require('process')
const cp = require('child_process')
const path = require('path')
const nock = require('nock')
const { Deployment } = require('./deployment')
const fakeJwt =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
describe('with all environment variables set', () => {
beforeEach(() => {
process.env.ACTIONS_RUNTIME_URL = 'http://my-url'
process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
process.env.GITHUB_TOKEN = 'gha-token'
process.env.GITHUB_SHA = '123abc'
process.env.GITHUB_ACTOR = 'monalisa'
process.env.GITHUB_ACTION = '__monalisa/octocat'
process.env.GITHUB_ACTION_PATH = 'something'
})
it('executes cleanly', done => {
const ip = path.join(__dirname, './index.js')
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
expect(stdout).toMatch(/::debug::all variables are set/)
done()
})
})
})
describe('with variables missing', () => {
it('execution fails if there are missing variables', done => {
delete process.env.ACTIONS_RUNTIME_URL
const ip = path.join(__dirname, './index.js')
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
expect(stdout).toBe('')
expect(err).toBeTruthy()
expect(err.code).toBe(1)
done()
})
})
})
describe('Deployment', () => {
beforeEach(() => {
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
process.env.GITHUB_TOKEN = 'gha-token'
process.env.GITHUB_SHA = '123abc'
process.env.GITHUB_ACTOR = 'monalisa'
process.env.GITHUB_ACTION = '__monalisa/octocat'
process.env.GITHUB_ACTION_PATH = 'something'
jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) {
case 'artifact_name':
return 'github-pages'
case 'token':
return process.env.GITHUB_TOKEN
default:
return process.env[`INPUT_${param.toUpperCase()}`] || ''
}
})
jest.spyOn(core, 'setOutput').mockImplementation(param => {
return param
})
jest.spyOn(core, 'setFailed').mockImplementation(param => {
return param
})
// Mock error/warning/info/debug
jest.spyOn(core, 'error').mockImplementation(jest.fn())
jest.spyOn(core, 'warning').mockImplementation(jest.fn())
jest.spyOn(core, 'info').mockImplementation(jest.fn())
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
})
describe('#create', () => {
afterEach(() => {
// Remove mock for `core.getInput('preview')`
delete process.env.INPUT_PREVIEW
})
it('can successfully create a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
const createDeploymentScope = nock('https://api.github.com')
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment`, {
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
pages_build_version: process.env.GITHUB_SHA,
oidc_token: fakeJwt
})
.reply(200, {
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/status/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
})
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
expect(core.setFailed).not.toHaveBeenCalled()
expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
)
artifactExchangeScope.done()
createDeploymentScope.done()
})
it('can successfully create a preview deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
const createDeploymentScope = nock('https://api.github.com')
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment`, {
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
pages_build_version: process.env.GITHUB_SHA,
oidc_token: fakeJwt,
preview: true
})
.reply(200, {
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/status/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome',
preview_url: 'https://actions.drafts.github.io/is-awesome'
})
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Return `"true"` for `core.getInput("preview")`
process.env.INPUT_PREVIEW = 'true'
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
expect(core.setFailed).not.toHaveBeenCalled()
expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
)
artifactExchangeScope.done()
createDeploymentScope.done()
})
it('reports errors with failed artifact exchange', async () => {
process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(400, {})
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad Request`
)
)
artifactExchangeScope.done()
})
it('reports errors with failed deployments', async () => {
process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] })
const createDeploymentScope = nock('https://api.github.com')
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment`, {
artifact_url: 'https://invalid-artifact.com&%24expand=SignedContent',
pages_build_version: process.env.GITHUB_SHA
})
.reply(400, { message: 'Bad request' })
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad request`
)
)
artifactExchangeScope.done()
createDeploymentScope.done()
})
})
describe('#check', () => {
it('sets output to success when deployment is successful', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
const createDeploymentScope = nock('https://api.github.com')
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment`, {
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
pages_build_version: process.env.GITHUB_SHA,
oidc_token: fakeJwt
})
.reply(200, {
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/status/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
})
const deploymentStatusScope = nock('https://api.github.com')
.get(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/status/${process.env.GITHUB_SHA}`)
.reply(200, {
status: 'succeed'
})
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
core.GetInput = jest.fn(input => {
switch (input) {
case 'timeout':
return 10 * 1000
case 'reporting_interval':
return 0
}
})
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
await deployment.check()
expect(core.setOutput).toBeCalledWith('status', 'succeed')
expect(core.info).toHaveBeenLastCalledWith('Reported success!')
artifactExchangeScope.done()
createDeploymentScope.done()
deploymentStatusScope.done()
})
})
describe('#cancel', () => {
it('can successfully cancel a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(200, {
value: [
{ url: 'https://another-artifact.com', name: 'another-artifact' },
{ url: 'https://fake-artifact.com', name: 'github-pages' }
]
})
const createDeploymentScope = nock('https://api.github.com')
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment`, {
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
pages_build_version: process.env.GITHUB_SHA,
oidc_token: fakeJwt
})
.reply(200, {
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/status/${process.env.GITHUB_SHA}`,
page_url: 'https://actions.github.io/is-awesome'
})
const cancelDeploymentScope = nock('https://api.github.com')
.put(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployment/cancel/${process.env.GITHUB_SHA}`)
.reply(200, {})
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
// Create the deployment
const deployment = new Deployment()
await deployment.create(fakeJwt)
// Cancel it
await deployment.cancel()
expect(core.info).toHaveBeenLastCalledWith(`Canceled deployment with ID ${process.env.GITHUB_SHA}`)
artifactExchangeScope.done()
createDeploymentScope.done()
cancelDeploymentScope.done()
})
})
})

View File

@@ -54,7 +54,7 @@ async function processRuntimeResponse(res, requestOptions) {
return response
}
async function getSignedArtifactUrl({ runtimeToken, workflowRunId, artifactName }) {
async function getSignedArtifactMetadata({ runtimeToken, workflowRunId, artifactName }) {
const { runTimeUrl: RUNTIME_URL } = getContext()
const artifactExchangeUrl = `${RUNTIME_URL}_apis/pipelines/workflows/${workflowRunId}/artifacts?api-version=6.0-preview`
@@ -88,7 +88,8 @@ async function getSignedArtifactUrl({ runtimeToken, workflowRunId, artifactName
throw error
}
const artifactRawUrl = data?.value?.find(artifact => artifact.name === artifactName)?.url
const artifact = data?.value?.find(artifact => artifact.name === artifactName)
const artifactRawUrl = artifact?.url
if (!artifactRawUrl) {
throw new Error(
'No uploaded artifact was found! Please check if there are any errors at build step, or uploaded artifact name is correct.'
@@ -96,7 +97,16 @@ async function getSignedArtifactUrl({ runtimeToken, workflowRunId, artifactName
}
const signedArtifactUrl = `${artifactRawUrl}&%24expand=SignedContent`
return signedArtifactUrl
const artifactSize = artifact?.size
if (!artifactSize) {
core.warning('Artifact size was not found. Unable to verify if artifact size exceeds the allowed size.')
}
return {
url: signedArtifactUrl,
size: artifactSize
}
}
async function createPagesDeployment({ githubToken, artifactUrl, buildVersion, idToken, isPreview = false }) {
@@ -113,7 +123,7 @@ async function createPagesDeployment({ githubToken, artifactUrl, buildVersion, i
core.info(`Creating Pages deployment with payload:\n${JSON.stringify(payload, null, '\t')}`)
try {
const response = await octokit.request('POST /repos/{owner}/{repo}/pages/deployment', {
const response = await octokit.request('POST /repos/{owner}/{repo}/pages/deployments', {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
...payload
@@ -131,7 +141,7 @@ async function getPagesDeploymentStatus({ githubToken, deploymentId }) {
core.info('Getting Pages deployment status...')
try {
const response = await octokit.request('GET /repos/{owner}/{repo}/pages/deployment/status/{deploymentId}', {
const response = await octokit.request('GET /repos/{owner}/{repo}/pages/deployments/{deploymentId}', {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
deploymentId
@@ -149,7 +159,7 @@ async function cancelPagesDeployment({ githubToken, deploymentId }) {
core.info('Canceling Pages deployment...')
try {
const response = await octokit.request('PUT /repos/{owner}/{repo}/pages/deployment/cancel/{deploymentId}', {
const response = await octokit.request('POST /repos/{owner}/{repo}/pages/deployments/{deploymentId}/cancel', {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
deploymentId
@@ -163,7 +173,7 @@ async function cancelPagesDeployment({ githubToken, deploymentId }) {
}
module.exports = {
getSignedArtifactUrl,
getSignedArtifactMetadata,
createPagesDeployment,
getPagesDeploymentStatus,
cancelPagesDeployment

View File

@@ -3,7 +3,7 @@ const core = require('@actions/core')
// All variables we need from the runtime are loaded here
const getContext = require('./context')
const {
getSignedArtifactUrl,
getSignedArtifactMetadata,
createPagesDeployment,
getPagesDeploymentStatus,
cancelPagesDeployment
@@ -17,12 +17,17 @@ const temporaryErrorStatus = {
const finalErrorStatus = {
deployment_failed: 'Deployment failed, try again later.',
deployment_perms_error: 'Deployment failed. Please ensure that the file permissions are correct.',
deployment_content_failed:
'Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.',
deployment_cancelled: 'Deployment cancelled.',
deployment_lost: 'Deployment failed to report final status.'
}
const MAX_TIMEOUT = 600000
const ONE_GIGABYTE = 1073741824
const SIZE_LIMIT_DESCRIPTION = '1 GB'
class Deployment {
constructor() {
const context = getContext()
@@ -39,25 +44,42 @@ class Deployment {
this.githubServerUrl = context.githubServerUrl
this.artifactName = context.artifactName
this.isPreview = context.isPreview === true
this.timeout = MAX_TIMEOUT
this.startTime = null
}
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
// by creating a deployment with that artifact
async create(idToken) {
if (Number(core.getInput('timeout')) > MAX_TIMEOUT) {
core.warning(
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
)
}
const timeoutInput = Number(core.getInput('timeout'))
this.timeout = !timeoutInput || timeoutInput <= 0 ? MAX_TIMEOUT : Math.min(timeoutInput, MAX_TIMEOUT)
try {
core.debug(`Actor: ${this.buildActor}`)
core.debug(`Action ID: ${this.actionsId}`)
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
const artifactUrl = await getSignedArtifactUrl({
const artifactData = await getSignedArtifactMetadata({
runtimeToken: this.runTimeToken,
workflowRunId: this.workflowRun,
artifactName: this.artifactName
})
if (artifactData?.size > ONE_GIGABYTE) {
core.warning(
`Uploaded artifact size of ${artifactData?.size} bytes exceeds the allowed size of ${SIZE_LIMIT_DESCRIPTION}. Deployment might fail.`
)
}
const deployment = await createPagesDeployment({
githubToken: this.githubToken,
artifactUrl,
artifactUrl: artifactData.url,
buildVersion: this.buildVersion,
idToken,
isPreview: this.isPreview
@@ -69,6 +91,7 @@ class Deployment {
id: deployment.id || deployment.status_url?.split('/')?.pop() || this.buildVersion,
pending: true
}
this.startTime = Date.now()
}
core.info(`Created deployment for ${this.buildVersion}, ID: ${this.deploymentInfo?.id}`)
@@ -79,9 +102,6 @@ class Deployment {
} catch (error) {
core.error(error.stack)
// output raw error in debug mode.
core.debug(JSON.stringify(error))
// build customized error message based on server response
if (error.response) {
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
@@ -92,12 +112,18 @@ class Deployment {
} else if (error.status === 404) {
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
errorMessage += `Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
// If using GHES, add a special note about compatibility
if (new URL(this.githubServerUrl).hostname.toLowerCase() !== 'github.com') {
errorMessage +=
'\nNote: This action version may not yet support GitHub Enterprise Server, please check the compatibility table.'
}
} else if (error.status >= 500) {
errorMessage +=
'Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.'
}
throw new Error(errorMessage)
} else {
// istanbul ignore next
throw error
}
}
@@ -116,11 +142,9 @@ class Deployment {
}
const deploymentId = this.deploymentInfo.id || this.buildVersion
const timeout = Number(core.getInput('timeout'))
const reportingInterval = Number(core.getInput('reporting_interval'))
const maxErrorCount = Number(core.getInput('error_count'))
let startTime = Date.now()
let errorCount = 0
// Time in milliseconds between two deployment status report when status errored, default 0.
@@ -162,9 +186,6 @@ class Deployment {
} catch (error) {
core.error(error.stack)
// output raw error in debug mode.
core.debug(JSON.stringify(error))
// build customized error message based on server response
if (error.response) {
errorStatus = error.status || error.response.status
@@ -188,7 +209,7 @@ class Deployment {
}
// Handle timeout
if (Date.now() - startTime >= timeout) {
if (Date.now() - this.startTime >= this.timeout) {
core.error('Timeout reached, aborting!')
core.setFailed('Timeout reached, aborting!')
@@ -202,6 +223,7 @@ class Deployment {
async cancel() {
// Don't attempt to cancel if no deployment was created
if (!this.deploymentInfo || this.deploymentInfo.pending !== true) {
core.debug('No deployment to cancel')
return
}
@@ -224,4 +246,4 @@ class Deployment {
}
}
module.exports = { Deployment }
module.exports = { Deployment, MAX_TIMEOUT, ONE_GIGABYTE, SIZE_LIMIT_DESCRIPTION }