Compare commits

...

109 Commits

Author SHA1 Message Date
dependabot[bot]
d58ec72e69 Bump the non-breaking-changes group across 1 directory with 5 updates
Bumps the non-breaking-changes group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) | `2.1.8` | `2.1.11` |
| [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.1` | `1.11.1` |
| [@vercel/ncc](https://github.com/vercel/ncc) | `0.38.1` | `0.38.2` |
| [nock](https://github.com/nock/nock) | `13.5.4` | `13.5.5` |
| [undici](https://github.com/nodejs/undici) | `6.19.2` | `6.20.1` |



Updates `@actions/artifact` from 2.1.8 to 2.1.11
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact)

Updates `@actions/core` from 1.10.1 to 1.11.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `@vercel/ncc` from 0.38.1 to 0.38.2
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.38.1...0.38.2)

Updates `nock` from 13.5.4 to 13.5.5
- [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.5.4...v13.5.5)

Updates `undici` from 6.19.2 to 6.20.1
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.19.2...v6.20.1)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: undici
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-14 18:36:41 +00:00
Joel Ambass
854d7aa1b9 Merge pull request #374 from actions/Jcambass-patch-1
Add workflow file for publishing releases to immutable action package
2024-10-03 11:03:50 +02:00
Joel Ambass
306bb814f2 Add workflow file for publishing releases to immutable action package
This workflow file publishes new action releases to the immutable action package of the same name as this repo.

This is part of the Immutable Actions project which is not yet fully released to the public. First party actions like this one are part of our initial testing of this feature.
2024-09-23 13:59:10 +02:00
Yoann Chaudet
b74272834a Merge pull request #360 from actions/dependabot/npm_and_yarn/npm_and_yarn-5134b82be1
Bump braces from 3.0.2 to 3.0.3 in the npm_and_yarn group across 1 directory
2024-07-17 18:23:37 -07:00
dependabot[bot]
72732942c6 Bump braces in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [braces](https://github.com/micromatch/braces).


Updates `braces` from 3.0.2 to 3.0.3
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 01:20:02 +00:00
Yoann Chaudet
963791f01c Merge pull request #361 from actions/dependabot-friendly
Make the rebuild dist workflow work nicer with Dependabot
2024-07-17 18:18:24 -07:00
Yoann Chaudet
51bb29d9d7 Make the rebuild dist workflow safer for Dependabot 2024-07-17 18:14:34 -07:00
Yoann Chaudet
89f3d10406 Merge pull request #358 from actions/dependabot/npm_and_yarn/non-breaking-changes-99c12deb21
Bump the non-breaking-changes group across 1 directory with 3 updates
2024-07-17 18:12:08 -07:00
Yoann Chaudet
bce735589b Merge branch 'main' into dependabot/npm_and_yarn/non-breaking-changes-99c12deb21 2024-07-17 17:51:30 -07:00
Yoann Chaudet
b13935cb88 Merge pull request #359 from garethsb/patch-1
Delete repeated sentence
2024-07-17 17:51:17 -07:00
Gareth Sylvester-Bradley
82ccaed7e0 Delete repeated sentence 2024-07-17 14:10:17 +01:00
github-actions[bot]
981e77b509 Update distributables after Dependabot 🤖 2024-07-15 18:39:04 +00:00
dependabot[bot]
479a2d958d Bump the non-breaking-changes group across 1 directory with 3 updates
Bumps the non-breaking-changes group with 3 updates in the / directory: [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact), [prettier](https://github.com/prettier/prettier) and [undici](https://github.com/nodejs/undici).


Updates `@actions/artifact` from 2.1.7 to 2.1.8
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact)

Updates `prettier` from 3.2.5 to 3.3.3
- [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.2.5...3.3.3)

Updates `undici` from 6.15.0 to 6.19.2
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.15.0...v6.19.2)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
- dependency-name: undici
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-15 18:38:31 +00:00
Fabian Aguilar Gomez
199a7354ab Merge pull request #348 from actions/oidc-doc
Update README.md
2024-05-31 14:48:46 -05:00
Fabian Aguilar Gomez
b2d396ab16 Update README.md
Co-authored-by: Mingzi  <yimysty@github.com>
2024-05-31 14:40:24 -05:00
Fabian Aguilar Gomez
4072571698 Update README.md 2024-05-31 14:38:24 -05:00
Fabian Aguilar Gomez
32d96c30ca add recommendations 2024-05-28 18:20:19 +00:00
Fabian Aguilar Gomez
2e8b6c7191 Update README.md 2024-05-23 14:41:32 -05:00
Fabian Aguilar Gomez
b352a2114c update readme 2024-05-23 19:28:52 +00:00
Fabian Aguilar Gomez
b8d7a0e861 Update README.md 2024-05-22 13:56:05 -05:00
James M. Greene
277bb4bf94 Merge pull request #341 from actions/dependabot/npm_and_yarn/non-breaking-changes-a62e391912
Bump the non-breaking-changes group with 4 updates
2024-05-01 21:32:53 -05:00
github-actions[bot]
808746ac60 Update distributables after Dependabot 🤖 2024-04-29 18:58:15 +00:00
dependabot[bot]
4ce84b32ca Bump the non-breaking-changes group with 4 updates
Bumps the non-breaking-changes group with 4 updates: [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact), [eslint-plugin-github](https://github.com/github/eslint-plugin-github), [nock](https://github.com/nock/nock) and [undici](https://github.com/nodejs/undici).


Updates `@actions/artifact` from 2.1.3 to 2.1.7
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact)

Updates `eslint-plugin-github` from 4.10.1 to 4.10.2
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.10.1...v4.10.2)

Updates `nock` from 13.5.3 to 13.5.4
- [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.5.3...v13.5.4)

Updates `undici` from 6.6.2 to 6.15.0
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.6.2...v6.15.0)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: undici
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 18:57:38 +00:00
Jess Bees
f517c444fc Merge pull request #340 from actions/remove-permissions-error
Remove error message for file permissions
2024-04-25 14:07:06 -04:00
Jess Bees
12a5abe890 Remove error message for file permissions 2024-04-25 14:04:20 -04:00
Jess Bees
d6db90164a Merge pull request #324 from actions/error-message-request-id
On API error, show the request ID of the API request
2024-03-15 14:57:41 -04:00
Jess Bees
055f4259a5 compile changes 2024-03-15 14:51:22 -04:00
Jess Bees
5ab929b077 Include request id in the error message of an error response 2024-03-15 13:37:14 -04:00
Yoann Chaudet
3ff795bc32 Merge pull request #318 from actions/dependabot/npm_and_yarn/non-breaking-changes-cbf1ca8c3f
Bump the non-breaking-changes group with 2 updates
2024-02-27 13:04:31 -08:00
github-actions[bot]
f5a2f0d405 Update distributables after Dependabot 🤖 2024-02-26 18:26:25 +00:00
dependabot[bot]
1364cde56e Bump the non-breaking-changes group with 2 updates
Bumps the non-breaking-changes group with 2 updates: [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) and [eslint](https://github.com/eslint/eslint).


Updates `@actions/artifact` from 2.1.1 to 2.1.3
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact)

Updates `eslint` from 8.56.0 to 8.57.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.56.0...v8.57.0)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-26 18:25:45 +00:00
Yoann Chaudet
2ed07f7488 Merge pull request #316 from actions/dependabot/npm_and_yarn/non-breaking-changes-7f25715340
Bump the non-breaking-changes group with 1 update
2024-02-23 11:58:13 -08:00
dependabot[bot]
d5a892b11c Bump the non-breaking-changes group with 1 update
Bumps the non-breaking-changes group with 1 update: [nock](https://github.com/nock/nock).


Updates `nock` from 13.5.1 to 13.5.3
- [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.5.1...v13.5.3)

---
updated-dependencies:
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: non-breaking-changes
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 18:36:54 +00:00
Yoann Chaudet
05977f58bc Merge pull request #314 from actions/dependabot/npm_and_yarn/non-breaking-changes-33f4238fbd
Bump the non-breaking-changes group with 3 updates
2024-02-12 11:21:14 -08:00
github-actions[bot]
9414024cfc Update distributables after Dependabot 🤖 2024-02-12 18:31:50 +00:00
dependabot[bot]
600e88d072 Bump the non-breaking-changes group with 3 updates
Bumps the non-breaking-changes group with 3 updates: [nock](https://github.com/nock/nock), [prettier](https://github.com/prettier/prettier) and [undici](https://github.com/nodejs/undici).


Updates `nock` from 13.4.0 to 13.5.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.4.0...v13.5.1)

Updates `prettier` from 3.1.1 to 3.2.5
- [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.1.1...3.2.5)

Updates `undici` from 6.2.1 to 6.6.2
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.2.1...v6.6.2)

---
updated-dependencies:
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
- dependency-name: undici
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: non-breaking-changes
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 18:31:14 +00:00
James M. Greene
a43ab5c2d5 Merge pull request #311 from actions/dependabot/github_actions/release-drafter/release-drafter-6.0.0
Bump release-drafter/release-drafter from 5.25.0 to 6.0.0
2024-02-06 23:57:42 -06:00
dependabot[bot]
9c8c21a7c6 Bump release-drafter/release-drafter from 5.25.0 to 6.0.0
Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 5.25.0 to 6.0.0.
- [Release notes](https://github.com/release-drafter/release-drafter/releases)
- [Commits](09c613e259...3f0f87098b)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-07 05:54:16 +00:00
James M. Greene
decdde0ac0 Merge pull request #295 from lmammino/patch-1
Update api-client.js
2024-02-05 18:31:01 -06:00
James M. Greene
0b3be6ba52 Update distributables 2024-02-05 18:29:18 -06:00
James M. Greene
c2c861cca0 Update tests 2024-02-05 18:29:06 -06:00
James M. Greene
294fbcd300 Merge branch 'main' into patch-1 2024-02-05 18:24:52 -06:00
James M. Greene
2a4b535672 Merge pull request #298 from SimonSiefke/fix/typo
fix typo: compatibilty -> compatibility
2024-02-05 18:21:47 -06:00
James M. Greene
4825f57d2c Merge branch 'main' into fix/typo 2024-02-05 18:21:08 -06:00
James M. Greene
fa29843a5a Merge pull request #310 from actions/dependabot/npm_and_yarn/actions/artifact-2.1.1
Bump @actions/artifact from 2.0.1 to 2.1.1
2024-02-05 18:16:59 -06:00
github-actions[bot]
d005625ad3 Update distributables after Dependabot 🤖 2024-02-02 22:15:49 +00:00
dependabot[bot]
636701b46d Bump @actions/artifact from 2.0.1 to 2.1.1
Bumps [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) from 2.0.1 to 2.1.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/http-client@2.1.1/packages/artifact)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-02 22:15:14 +00:00
James M. Greene
25b80099b0 Merge pull request #307 from actions/dependabot-grouping
Update Dependabot config to group non-breaking changes
2024-01-31 11:27:14 -06:00
James M. Greene
ace85779a4 Update Dependabot config to group non-breaking changes 2024-01-31 00:31:50 -06:00
Simon Siefke
22931f5a71 fix: typo 2024-01-11 22:37:44 +01:00
Jess Bees
87c3283f01 Merge pull request #297 from actions/bump-actions-artifact
Bump actions/artifact to 2.0.1
2024-01-11 14:38:36 -05:00
Jess Bees
87625d9f1e Bump actions/artifact to 2.0.1 2024-01-11 14:25:49 -05:00
Luciano Mammino
8de45ac1dc Update api-client.js
reference actions/upload-artifact@v4 (rather than actions/artifact@v4, which I couldn't find)
2024-01-06 12:34:08 +00:00
James M. Greene
7a9bd943aa Merge pull request #290 from actions/dependabot/npm_and_yarn/undici-6.2.1
Bump undici from 6.0.1 to 6.2.1
2023-12-22 15:06:56 -06:00
github-actions[bot]
eee8a27158 Update distributables after Dependabot 🤖 2023-12-22 21:05:09 +00:00
dependabot[bot]
b6e5c85160 Bump undici from 6.0.1 to 6.2.1
Bumps [undici](https://github.com/nodejs/undici) from 6.0.1 to 6.2.1.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.0.1...v6.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 21:04:34 +00:00
James M. Greene
b8d2528df3 Merge pull request #282 from actions/dependabot/github_actions/github/codeql-action-3
Bump github/codeql-action from 2 to 3
2023-12-22 14:59:54 -06:00
dependabot[bot]
53d1eac7fd Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 20:07:30 +00:00
James M. Greene
3f0ef9d75d Merge pull request #281 from actions/dependabot/github_actions/actions/upload-artifact-4
Bump actions/upload-artifact from 3 to 4
2023-12-22 14:06:26 -06:00
dependabot[bot]
82751044df Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 20:02:08 +00:00
James M. Greene
9be9d731c9 Merge pull request #280 from actions/dependabot/npm_and_yarn/eslint-8.56.0
Bump eslint from 8.55.0 to 8.56.0
2023-12-22 14:00:52 -06:00
dependabot[bot]
d8afefafec Bump eslint from 8.55.0 to 8.56.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.55.0 to 8.56.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.55.0...v8.56.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-22 19:59:23 +00:00
James M. Greene
304d0b77f8 Merge pull request #277 from actions/dependabot/github_actions/actions/publish-action-0.3.0
Bump actions/publish-action from 0.2.2 to 0.3.0
2023-12-22 13:49:20 -06:00
dependabot[bot]
3a33eeefa1 Bump actions/publish-action from 0.2.2 to 0.3.0
Bumps [actions/publish-action](https://github.com/actions/publish-action) from 0.2.2 to 0.3.0.
- [Commits](https://github.com/actions/publish-action/compare/v0.2.2...v0.3.0)

---
updated-dependencies:
- dependency-name: actions/publish-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 19:47:48 +00:00
James M. Greene
d8af841ac3 Merge pull request #288 from actions/use-artifacts-client
Use the Actions artifacts client to avoid needing the `actions: read` permission
2023-12-22 13:31:06 -06:00
James M. Greene
35a0f06cfc Add empty request body for more completeness 2023-12-22 13:27:24 -06:00
James M. Greene
5cba2b1245 Display artifact name in some post-filter error messages 2023-12-22 13:16:13 -06:00
James M. Greene
e03d00b325 Update distributables 2023-12-22 12:53:32 -06:00
James M. Greene
d6fbcf80b1 Log the more raw error message from Twirp 2023-12-22 12:53:15 -06:00
James M. Greene
013b725db3 Oxford commas 2023-12-22 12:52:56 -06:00
James M. Greene
ed0e794532 Minimizing unnecessary differences 2023-12-22 11:47:20 -06:00
James M. Greene
1c0b543596 Remove 'actions: read' permissions from README 2023-12-22 11:42:50 -06:00
James M. Greene
fe3d75dd3a Update distributables 2023-12-22 11:41:22 -06:00
James M. Greene
b3879bac7d Update tests 2023-12-22 11:41:10 -06:00
James M. Greene
72ab98158a Wrap Twirp responses like Octokit responses for consistency 2023-12-22 11:40:57 -06:00
James M. Greene
c704b8a6e2 Remove 'total_count' from fake responses in tests 2023-12-22 11:22:10 -06:00
James M. Greene
02cb90ee32 Update distributables 2023-12-22 09:29:56 -06:00
James M. Greene
88807a7a35 Fix formatting 2023-12-22 09:29:47 -06:00
Jess Bees
e386446c2a Catch artifact-client errors differently from octokit errors 2023-12-22 10:25:57 -05:00
Jess Bees
340b369533 Correct size field in response payload 2023-12-21 18:43:25 -05:00
Jess Bees
4be34033fc Fix *most* tests 2023-12-21 16:10:50 -05:00
Jess Bees
0486580c63 Set the right env variables to get artifacts client to initialize 2023-12-21 14:39:05 -05:00
James M. Greene
af9eaca61c Merge branch 'main' into use-artifacts-client 2023-12-20 10:57:21 -06:00
James M. Greene
81251b551f Use the Actions artifacts client to avoid needing the actions-read permission 2023-12-20 10:56:51 -06:00
James M. Greene
47cf65bf47 Merge pull request #283 from actions/update-readme-for-v4
Update README to reflect v4
2023-12-20 10:40:31 -06:00
Jess Bees
1a1c979b91 clarify GHES compatibility 2023-12-19 12:15:02 -05:00
Jess Bees
925d92be20 clarify actions permission 2023-12-19 12:13:19 -05:00
Jess Bees
b80d7fe30e Update README.md
Co-authored-by: Tommy Byrd <tcbyrd@github.com>
2023-12-19 11:27:25 -05:00
Jess Bees
d724c5069f Update README to reflect v4
* Changes version tag in sample code
* Adds newly required permission
* Notes that v4 isn't compatible with GHES yet
2023-12-19 10:03:19 -05:00
Jess Bees
f33f41b675 Merge pull request #279 from actions/artifacts-next-ga
Use artifacts v4
2023-12-18 20:42:41 -05:00
Jess Bees
0d45f33cde pretty 2023-12-15 10:54:04 -05:00
Jess Bees
d1e23d0efd Merge branch 'main' into artifacts-next-ga 2023-12-15 10:50:33 -05:00
Jess Bees
125d07c91d Merge pull request #251 from konradpabjan/main
Deploy pages using artifact IDs
2023-11-03 14:07:27 -04:00
Konrad Pabjan
7496661f94 Undo unnecessary reorder 2023-10-30 15:44:53 -04:00
Konrad Pabjan
4279385f7d Add extra test 2023-10-30 15:36:01 -04:00
Konrad Pabjan
a075a5970d Rebuild the dist folder 2023-10-30 15:07:46 -04:00
Konrad Pabjan
b15b65d3e5 Misc tweaks 2023-10-30 15:04:12 -04:00
Konrad Pabjan
fa898e325d Update tests + cleanup 2023-10-30 14:58:12 -04:00
Konrad Pabjan
d45e4be1a6 WIP 2023-10-27 17:52:04 -04:00
Konrad Pabjan
b12897a760 WIP 2023-10-27 17:50:16 -04:00
Konrad Pabjan
499890a085 WIP 2023-10-27 17:40:12 -04:00
Konrad Pabjan
324d9f15de WIP 2023-10-27 17:00:48 -04:00
Konrad Pabjan
2196d013ad WIP 2023-10-27 16:49:22 -04:00
Konrad Pabjan
ce81cfb969 WIP 2023-10-27 16:47:13 -04:00
Konrad Pabjan
da4705cd08 WIP 2023-10-27 16:41:02 -04:00
Konrad Pabjan
961a4a1557 WIP 2023-10-27 16:34:41 -04:00
Konrad Pabjan
38d3e68bdc Build 2023-10-27 16:19:24 -04:00
Konrad Pabjan
08232476b8 WIP 2023-10-27 16:13:35 -04:00
Yoann Chaudet
f69bebbdd5 Improve the README on all things artifacts 2023-07-27 22:30:35 -07:00
20 changed files with 121974 additions and 15877 deletions

View File

@@ -4,8 +4,14 @@ updates:
directory: '/' directory: '/'
schedule: schedule:
interval: 'weekly' interval: 'weekly'
groups:
non-breaking-changes:
update-types: [minor, patch]
- package-ecosystem: 'npm' - package-ecosystem: 'npm'
directory: '/' directory: '/'
schedule: schedule:
interval: 'weekly' interval: 'weekly'
groups:
non-breaking-changes:
update-types: [minor, patch]

View File

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

View File

@@ -46,7 +46,7 @@ jobs:
fi fi
# If index.js was different than expected, upload the expected version as an artifact # If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }} if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with: with:
name: dist name: dist

View File

@@ -42,7 +42,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v2 uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
@@ -67,4 +67,4 @@ jobs:
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v3

View File

@@ -11,6 +11,6 @@ jobs:
draft-release: draft-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 # v5.25.0 - uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,20 @@
name: 'Publish Immutable Action Version'
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checking out
uses: actions/checkout@v4
- name: Publish
id: publish
uses: actions/publish-immutable-action@0.0.3

View File

@@ -45,7 +45,7 @@ jobs:
git add dist/ git add dist/
git config --local user.name "github-actions[bot]" git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update distributables after Dependabot 🤖" git commit -m "[dependabot skip] Update distributables after Dependabot 🤖"
echo "Pushing branch ${{ github.ref_name }}" echo "Pushing branch ${{ github.ref_name }}"
git push origin ${{ github.ref_name }} git push origin ${{ github.ref_name }}
fi fi

View File

@@ -24,7 +24,7 @@ jobs:
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag id: update-major-tag
uses: actions/publish-action@v0.2.2 uses: actions/publish-action@v0.3.0
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@@ -6,11 +6,11 @@ This action is used to deploy [Actions artifacts][artifacts] to [GitHub Pages](h
## Usage ## Usage
See [action.yml](action.yml) for the various `inputs` this action supports. See [action.yml](action.yml) for the various `inputs` this action supports (or [below](#inputs-📥)).
For examples that make use of this action, check out our [starter-workflows][starter-workflows] in a variety of frameworks. 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 when using [`actions/upload-pages-artifact`][upload-pages-artifact]. This action deploys a Pages site previously uploaded as an artifact (e.g. using [`actions/upload-pages-artifact`][upload-pages-artifact]).
We recommend this action to be used in a dedicated job: We recommend this action to be used in a dedicated job:
@@ -41,7 +41,7 @@ jobs:
steps: steps:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v3 # or specific "vX.X.X" version tag for this action uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
``` ```
### Inputs 📥 ### Inputs 📥
@@ -71,7 +71,7 @@ jobs:
There are a few important considerations to be aware of: There are a few important considerations to be aware of:
1. The artifact being deployed must have been uploaded in a previous step, either in the same job or a separate job that doesn't execute until the upload is complete. 1. The artifact being deployed must have been uploaded in a previous step, either in the same job or a separate job that doesn't execute until the upload is complete. See [`actions/upload-pages-artifact`][upload-pages-artifact] for more information about the format of the artifact we expect.
2. The job that executes the deployment must at minimum have the following permissions: 2. The job that executes the deployment must at minimum have the following permissions:
- `pages: write` - `pages: write`
@@ -83,12 +83,19 @@ There are a few important considerations to be aware of:
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). 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).
## OIDC
When we invoke a job using GitHub Actions the job requests an OIDC token from GitHub's OIDC provider which responds with a JSON web token (JWT). Each token is unique to each workflow job [learn more about OIDC tokens](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#understanding-the-oidc-token).
OIDC tokens are minted within the context of a single job, and are used to form a trust relationship which validates properties of the workflow run against a third-party (e.g. cloud providers such as AWS or Azure). In the context of GitHub Pages, this is most relevant to ensure a workflow respects branch protection settings. To do this, the OIDC token includes a claim about which branch/ref is executing the workflow. The token is passed to the pages deployment API as part of the request payload, where it's decoded internally to validate the claims and verify if that workflow is allowed to deploy to pages.
A common question regarding OIDC tokens is the need to use both `pages:write` and `id-token:write`. The pages permission relates to the `GITHUB_TOKEN` by giving it the permissions to create pages deployments when calling the GitHub API. The id-token permission is necessary to request the OIDC JWT token. For more information on the id-token, check the docs on [adding permissions settings](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-cloud-providers#adding-permissions-settings).
## Compatibility ## 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. 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 | | Release | GHES Compatibility |
|:---|:---| |:---|:---|
| [`v4`](https://github.com/actions/deploy-pages/releases/tag/v4) | :warning: Incompatible at this time |
| [`v3`](https://github.com/actions/deploy-pages/releases/tag/v3) | `>= 3.9` | | [`v3`](https://github.com/actions/deploy-pages/releases/tag/v3) | `>= 3.9` |
| `v3.x.x` | `>= 3.9` | | `v3.x.x` | `>= 3.9` |
| [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | `>= 3.9` | | [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | `>= 3.9` |

View File

@@ -1 +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> <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: 80.84%"><title>Coverage: 80.84%</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">80.84%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">80.84%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

126737
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

2842
dist/licenses.txt generated vendored

File diff suppressed because it is too large Load Diff

7538
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,22 +4,22 @@
"description": "Deploy an actions artifact to GitHub Pages", "description": "Deploy an actions artifact to GitHub Pages",
"main": "./dist/index.js", "main": "./dist/index.js",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/artifact": "^2.1.11",
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@actions/http-client": "^2.2.0",
"@octokit/request-error": "^5.0.1", "@octokit/request-error": "^5.0.1",
"http-status-messages": "^1.1.0" "http-status-messages": "^1.1.0"
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.2",
"eslint": "^8.55.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-github": "^4.10.1", "eslint-plugin-github": "^4.10.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"make-coverage-badge": "^1.2.0", "make-coverage-badge": "^1.2.0",
"nock": "^13.4.0", "nock": "^13.5.5",
"prettier": "^3.1.0", "prettier": "^3.3.3",
"undici": "^6.0.0" "undici": "^6.20.1"
}, },
"scripts": { "scripts": {
"all": "npm run format && npm run lint && npm run prepare && npm run test && npm run coverage-badge", "all": "npm run format && npm run lint && npm run prepare && npm run test && npm run coverage-badge",

View File

@@ -4,9 +4,7 @@ const path = require('path')
describe('with all environment variables set', () => { describe('with all environment variables set', () => {
beforeEach(() => { beforeEach(() => {
process.env.ACTIONS_RUNTIME_URL = 'http://my-url'
process.env.GITHUB_RUN_ID = '123' process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
process.env.GITHUB_REPOSITORY = 'actions/is-awesome' process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
process.env.GITHUB_TOKEN = 'gha-token' process.env.GITHUB_TOKEN = 'gha-token'
process.env.GITHUB_SHA = '123abc' process.env.GITHUB_SHA = '123abc'
@@ -26,7 +24,7 @@ describe('with all environment variables set', () => {
describe('with variables missing', () => { describe('with variables missing', () => {
it('execution fails if there are missing variables', done => { it('execution fails if there are missing variables', done => {
delete process.env.ACTIONS_RUNTIME_URL delete process.env.GITHUB_RUN_ID
const ip = path.join(__dirname, '../index.js') const ip = path.join(__dirname, '../index.js')
cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => { cp.exec(`node ${ip}`, { env: process.env }, (err, stdout) => {
expect(stdout).toBe('') expect(stdout).toBe('')

View File

@@ -9,20 +9,24 @@ const { Deployment, MAX_TIMEOUT, ONE_GIGABYTE, SIZE_LIMIT_DESCRIPTION } = requir
const fakeJwt = const fakeJwt =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w' 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjllMWIxOC1jOGFiLTRhZGQtOGYxOC03MzVlMzVjZGJhZjAiLCJzdWIiOiJyZXBvOnBhcGVyLXNwYS9taW55aTplbnZpcm9ubWVudDpQcm9kdWN0aW9uIiwiYXVkIjoiaHR0cHM6Ly9naXRodWIuY29tL3BhcGVyLXNwYSIsInJlZiI6InJlZnMvaGVhZHMvbWFpbiIsInNoYSI6ImEyODU1MWJmODdiZDk3NTFiMzdiMmM0YjM3M2MxZjU3NjFmYWM2MjYiLCJyZXBvc2l0b3J5IjoicGFwZXItc3BhL21pbnlpIiwicmVwb3NpdG9yeV9vd25lciI6InBhcGVyLXNwYSIsInJ1bl9pZCI6IjE1NDY0NTkzNjQiLCJydW5fbnVtYmVyIjoiMzQiLCJydW5fYXR0ZW1wdCI6IjIiLCJhY3RvciI6IllpTXlzdHkiLCJ3b3JrZmxvdyI6IkNJIiwiaGVhZF9yZWYiOiIiLCJiYXNlX3JlZiI6IiIsImV2ZW50X25hbWUiOiJwdXNoIiwicmVmX3R5cGUiOiJicmFuY2giLCJlbnZpcm9ubWVudCI6IlByb2R1Y3Rpb24iLCJqb2Jfd29ya2Zsb3dfcmVmIjoicGFwZXItc3BhL21pbnlpLy5naXRodWIvd29ya2Zsb3dzL2JsYW5rLnltbEByZWZzL2hlYWRzL21haW4iLCJpc3MiOiJodHRwczovL3Rva2VuLmFjdGlvbnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwibmJmIjoxNjM4ODI4MDI4LCJleHAiOjE2Mzg4Mjg5MjgsImlhdCI6MTYzODgyODYyOH0.1wyupfxu1HGoTyIqatYg0hIxy2-0bMO-yVlmLSMuu2w'
const LIST_ARTIFACTS_TWIRP_PATH = '/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts'
describe('Deployment', () => { describe('Deployment', () => {
let mockPool let mockPool
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks() jest.clearAllMocks()
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
process.env.GITHUB_RUN_ID = '123' process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
process.env.GITHUB_REPOSITORY = 'actions/is-awesome' process.env.GITHUB_REPOSITORY = 'actions/is-awesome'
process.env.GITHUB_TOKEN = 'gha-token' process.env.GITHUB_TOKEN = 'gha-token'
process.env.GITHUB_SHA = '123abc' process.env.GITHUB_SHA = '123abc'
process.env.GITHUB_ACTOR = 'monalisa' process.env.GITHUB_ACTOR = 'monalisa'
process.env.GITHUB_ACTION = '__monalisa/octocat' process.env.GITHUB_ACTION = '__monalisa/octocat'
process.env.GITHUB_ACTION_PATH = 'something' process.env.GITHUB_ACTION_PATH = 'something'
// A valid actions token must have an 'scp' field whose value is a space-delimited list of strings
process.env.ACTIONS_RUNTIME_TOKEN =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY3AiOiJBY3Rpb25zLkV4YW1wbGVTY29wZSBBY3Rpb25zLlJlc3VsdHM6Y2U3ZjU0YzctNjFjNy00YWFlLTg4N2YtMzBkYTQ3NWY1ZjFhOmNhMzk1MDg1LTA0MGEtNTI2Yi0yY2U4LWJkYzg1ZjY5Mjc3NCJ9.l-VcBU1PeNk_lWpOhjWehQlYyjCcY2dp_EMt7Rf06io'
process.env.ACTIONS_RESULTS_URL = 'https://actions-results-url.biz'
jest.spyOn(core, 'getInput').mockImplementation(param => { jest.spyOn(core, 'getInput').mockImplementation(param => {
switch (param) { switch (param) {
@@ -52,7 +56,7 @@ describe('Deployment', () => {
jest.spyOn(core, 'debug').mockImplementation(jest.fn()) jest.spyOn(core, 'debug').mockImplementation(jest.fn())
// Set up Fetch mocking // Set up Fetch mocking
const mockAgent = new MockAgent() let mockAgent = new MockAgent()
mockAgent.disableNetConnect() mockAgent.disableNetConnect()
setGlobalDispatcher(mockAgent) setGlobalDispatcher(mockAgent)
mockPool = mockAgent.get('https://api.github.com') mockPool = mockAgent.get('https://api.github.com')
@@ -67,14 +71,15 @@ describe('Deployment', () => {
it('can successfully create a deployment', async () => { it('can successfully create a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -85,10 +90,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.pages_build_version === process.env.GITHUB_SHA && body.pages_build_version === process.env.GITHUB_SHA &&
body.oidc_token === fakeJwt body.oidc_token === fakeJwt
) )
@@ -113,21 +118,21 @@ describe('Deployment', () => {
expect(core.info).toHaveBeenLastCalledWith( expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`)) expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
it('can successfully create a preview deployment', async () => { it('can successfully create a preview deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -138,11 +143,11 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 4 && keys.length === 4 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
keys[3] === 'preview' && keys[3] === 'preview' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.pages_build_version === process.env.GITHUB_SHA && body.pages_build_version === process.env.GITHUB_SHA &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.preview === true body.preview === true
@@ -172,32 +177,45 @@ describe('Deployment', () => {
expect(core.info).toHaveBeenLastCalledWith( expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`)) expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
it('reports errors with failed artifact exchange', async () => { it('reports errors with failed artifact metadata exchange', async () => {
process.env.GITHUB_SHA = 'invalid-build-version' process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.reply(400, {}) .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(400, { msg: 'yikes!' }, { 'content-type': 'application/json' })
// Create the deployment // Create the deployment
const deployment = new Deployment() const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual( await expect(deployment.create()).rejects.toThrow(
new Error( `Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}.`
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad Request`
)
) )
expect(core.error).toHaveBeenNthCalledWith(
artifactExchangeScope.done() 1,
'Listing artifact metadata failed',
new Error('Failed to ListArtifacts: Received non-retryable error: Failed request: (400) null: yikes!')
)
expect(core.error).toHaveBeenNthCalledWith(
2,
'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.',
expect.any(Error)
)
twirpScope.done()
}) })
it('reports errors with a failed 500 in a deployment', async () => { it('reports errors with a failed 500 in a deployment', async () => {
process.env.GITHUB_SHA = 'build-version' process.env.GITHUB_SHA = 'build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] }) .reply(
200,
{
artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -208,9 +226,9 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 2 && keys.length === 2 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'pages_build_version' && keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
} }
@@ -224,15 +242,20 @@ describe('Deployment', () => {
`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.` `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.`
) )
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
it('reports errors with an unexpected 403 during deployment', async () => { it('reports errors with an unexpected 403 during deployment', async () => {
process.env.GITHUB_SHA = 'build-version' process.env.GITHUB_SHA = 'build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] }) .reply(
200,
{
artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -243,9 +266,9 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 2 && keys.length === 2 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'pages_build_version' && keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
} }
@@ -259,15 +282,20 @@ describe('Deployment', () => {
`Failed to create deployment (status: 403) with build version ${process.env.GITHUB_SHA}. Ensure GITHUB_TOKEN has permission "pages: write".` `Failed to create deployment (status: 403) with build version ${process.env.GITHUB_SHA}. Ensure GITHUB_TOKEN has permission "pages: write".`
) )
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
it('reports errors with an unexpected 404 during deployment', async () => { it('reports errors with an unexpected 404 during deployment', async () => {
process.env.GITHUB_SHA = 'build-version' process.env.GITHUB_SHA = 'build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] }) .reply(
200,
{
artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -278,9 +306,9 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 2 && keys.length === 2 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'pages_build_version' && keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
} }
@@ -294,15 +322,20 @@ describe('Deployment', () => {
`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` `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`
) )
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
it('reports errors with failed deployments', async () => { it('reports errors with failed deployments', async () => {
process.env.GITHUB_SHA = 'invalid-build-version' process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { value: [{ url: 'https://invalid-artifact.com', name: 'github-pages' }] }) .reply(
200,
{
artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
},
{ headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -313,9 +346,9 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 2 && keys.length === 2 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'pages_build_version' && keys[1] === 'pages_build_version' &&
body.artifact_url === 'https://invalid-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
} }
@@ -329,22 +362,90 @@ describe('Deployment', () => {
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad request` `Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad request`
) )
) )
twirpScope.done()
})
artifactExchangeScope.done() it('fails if there are multiple artifacts with the same name', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(
200,
{
artifacts: [
{ databaseId: 13, name: 'github-pages', size: 1400 },
{ databaseId: 14, name: 'github-pages', size: 1620 }
]
},
{ headers: { 'content-type': 'application/json' } }
)
const deployment = new Deployment()
await expect(deployment.create(fakeJwt)).rejects.toThrow(
`Multiple artifacts named "github-pages" were unexpectedly found for this workflow run. Artifact count is 2.`
)
twirpScope.done()
})
it('fails if there are no artifacts found', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(
200,
{
artifacts: []
},
{ headers: { 'content-type': 'application/json' } }
)
const deployment = new Deployment()
await expect(deployment.create(fakeJwt)).rejects.toThrow(
`No artifacts named "github-pages" were found for this workflow run. Ensure artifacts are uploaded with actions/upload-artifact@v4 or later.`
)
twirpScope.done()
})
it('fails with error message if list artifact endpoint returns 501', async () => {
process.env.GITHUB_SHA = 'valid-build-version'
const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(501, { msg: 'oh no' }, { headers: { 'content-type': 'application/json' } })
const deployment = new Deployment()
await expect(deployment.create(fakeJwt)).rejects.toThrow(
`Failed to create deployment (status: 501) 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.`
)
expect(core.error).toHaveBeenNthCalledWith(
1,
'Listing artifact metadata failed',
new Error('Failed to ListArtifacts: Received non-retryable error: Failed request: (501) null: oh no')
)
expect(core.error).toHaveBeenNthCalledWith(
2,
'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.',
expect.any(Error)
)
twirpScope.done()
}) })
it('warns if the artifact size is bigger than maximum', async () => { it('warns if the artifact size is bigger than maximum', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactSize = ONE_GIGABYTE + 1 const artifactSize = ONE_GIGABYTE + 1
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://fake-artifact.com', name: 'github-pages', size: `${artifactSize}` }, {
{ url: 'https://another-artifact.com', name: 'another-artifact' } artifacts: [{ databaseId: 12, name: 'github-pages', size: artifactSize }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -355,10 +456,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 12 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -383,21 +484,21 @@ describe('Deployment', () => {
expect(core.info).toHaveBeenLastCalledWith( expect(core.info).toHaveBeenLastCalledWith(
expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`)) expect.stringMatching(new RegExp(`^Created deployment for ${process.env.GITHUB_SHA}`))
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
it('warns when the timeout is greater than the maximum allowed', async () => { it('warns when the timeout is greater than the maximum allowed', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -408,10 +509,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -450,8 +551,7 @@ describe('Deployment', () => {
expect(core.warning).toBeCalledWith( expect(core.warning).toBeCalledWith(
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.` `Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
) )
twirpScope.done()
artifactExchangeScope.done()
}) })
}) })
@@ -459,14 +559,15 @@ describe('Deployment', () => {
it('sets output to success when deployment is successful', async () => { it('sets output to success when deployment is successful', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -477,10 +578,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -511,8 +612,7 @@ describe('Deployment', () => {
expect(core.setOutput).toBeCalledWith('status', 'succeed') expect(core.setOutput).toBeCalledWith('status', 'succeed')
expect(core.info).toHaveBeenLastCalledWith('Reported success!') expect(core.info).toHaveBeenLastCalledWith('Reported success!')
twirpScope.done()
artifactExchangeScope.done()
}) })
it('fails check when no deployment is found', async () => { it('fails check when no deployment is found', async () => {
@@ -525,14 +625,15 @@ describe('Deployment', () => {
it('exits early when deployment is not in progress', async () => { it('exits early when deployment is not in progress', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -543,10 +644,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -568,21 +669,21 @@ describe('Deployment', () => {
deployment.deploymentInfo.pending = false deployment.deploymentInfo.pending = false
await deployment.check() await deployment.check()
expect(core.setFailed).toBeCalledWith('Unable to get deployment status.') expect(core.setFailed).toBeCalledWith('Unable to get deployment status.')
twirpScope.done()
artifactExchangeScope.done()
}) })
it('enforces max timeout', async () => { it('enforces max timeout', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -593,10 +694,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -664,21 +765,21 @@ describe('Deployment', () => {
expect(deployment.timeout).toEqual(MAX_TIMEOUT) expect(deployment.timeout).toEqual(MAX_TIMEOUT)
expect(core.error).toBeCalledWith('Timeout reached, aborting!') expect(core.error).toBeCalledWith('Timeout reached, aborting!')
expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!') expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!')
twirpScope.done()
artifactExchangeScope.done()
}) })
it('sets timeout to user timeout if user timeout is less than max timeout', async () => { it('sets timeout to user timeout if user timeout is less than max timeout', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -689,10 +790,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -749,21 +850,21 @@ describe('Deployment', () => {
expect(deployment.timeout).toEqual(42) expect(deployment.timeout).toEqual(42)
expect(core.error).toBeCalledWith('Timeout reached, aborting!') expect(core.error).toBeCalledWith('Timeout reached, aborting!')
expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!') expect(core.setFailed).toBeCalledWith('Timeout reached, aborting!')
twirpScope.done()
artifactExchangeScope.done()
}) })
it('sets output to success when timeout is set but not reached', async () => { it('sets output to success when timeout is set but not reached', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -774,10 +875,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -835,8 +936,7 @@ describe('Deployment', () => {
expect(core.error).not.toBeCalled() expect(core.error).not.toBeCalled()
expect(core.setOutput).toBeCalledWith('status', 'succeed') expect(core.setOutput).toBeCalledWith('status', 'succeed')
expect(core.info).toHaveBeenLastCalledWith('Reported success!') expect(core.info).toHaveBeenLastCalledWith('Reported success!')
twirpScope.done()
artifactExchangeScope.done()
}) })
}) })
@@ -844,14 +944,15 @@ describe('Deployment', () => {
it('can successfully cancel a deployment', async () => { it('can successfully cancel a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -862,10 +963,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -897,8 +998,7 @@ describe('Deployment', () => {
await deployment.cancel() await deployment.cancel()
expect(core.info).toHaveBeenLastCalledWith(`Canceled deployment with ID ${process.env.GITHUB_SHA}`) expect(core.info).toHaveBeenLastCalledWith(`Canceled deployment with ID ${process.env.GITHUB_SHA}`)
twirpScope.done()
artifactExchangeScope.done()
}) })
it('can exit if a pages deployment was not created and none need to be cancelled', async () => { it('can exit if a pages deployment was not created and none need to be cancelled', async () => {
@@ -917,14 +1017,15 @@ describe('Deployment', () => {
it('catches an error when trying to cancel a deployment', async () => { it('catches an error when trying to cancel a deployment', async () => {
process.env.GITHUB_SHA = 'valid-build-version' process.env.GITHUB_SHA = 'valid-build-version'
const artifactExchangeScope = nock(`http://my-url`) const twirpScope = nock(process.env.ACTIONS_RESULTS_URL)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview') .post(LIST_ARTIFACTS_TWIRP_PATH)
.reply(200, { .reply(
value: [ 200,
{ url: 'https://another-artifact.com', name: 'another-artifact' }, {
{ url: 'https://fake-artifact.com', name: 'github-pages' } artifacts: [{ databaseId: 11, name: 'github-pages', size: 221 }]
] },
}) { headers: { 'content-type': 'application/json' } }
)
mockPool mockPool
.intercept({ .intercept({
@@ -935,10 +1036,10 @@ describe('Deployment', () => {
const keys = Object.keys(body).sort() const keys = Object.keys(body).sort()
return ( return (
keys.length === 3 && keys.length === 3 &&
keys[0] === 'artifact_url' && keys[0] === 'artifact_id' &&
keys[1] === 'oidc_token' && keys[1] === 'oidc_token' &&
keys[2] === 'pages_build_version' && keys[2] === 'pages_build_version' &&
body.artifact_url === 'https://fake-artifact.com&%24expand=SignedContent' && body.artifact_id === 11 &&
body.oidc_token === fakeJwt && body.oidc_token === fakeJwt &&
body.pages_build_version === process.env.GITHUB_SHA body.pages_build_version === process.env.GITHUB_SHA
) )
@@ -970,8 +1071,7 @@ describe('Deployment', () => {
await deployment.cancel() await deployment.cancel()
expect(core.error).toHaveBeenCalledWith(`Canceling Pages deployment failed`, expect.anything()) expect(core.error).toHaveBeenCalledWith(`Canceling Pages deployment failed`, expect.anything())
twirpScope.done()
artifactExchangeScope.done()
}) })
}) })
}) })

View File

@@ -1,119 +1,118 @@
const core = require('@actions/core') const core = require('@actions/core')
const github = require('@actions/github') const github = require('@actions/github')
const hc = require('@actions/http-client') const { DefaultArtifactClient } = require('@actions/artifact')
const { RequestError } = require('@octokit/request-error') const { RequestError } = require('@octokit/request-error')
const HttpStatusMessages = require('http-status-messages') const HttpStatusMessages = require('http-status-messages')
// All variables we need from the runtime are loaded here function wrapTwirpResponseLikeOctokit(twirpResponse, requestOptions) {
const getContext = require('./context')
async function processRuntimeResponse(res, requestOptions) {
// Parse the response body as JSON
let obj = null
try {
const contents = await res.readBody()
if (contents && contents.length > 0) {
obj = JSON.parse(contents)
}
} catch (error) {
// Invalid resource (contents not json); leaving resulting obj as null
}
// Specific response shape aligned with Octokit // Specific response shape aligned with Octokit
const response = { const response = {
url: res.message?.url || requestOptions.url, url: requestOptions.url,
status: res.message?.statusCode || 0, status: 200,
headers: { headers: {
...res.message?.headers ...requestOptions.headers
}, },
data: obj data: twirpResponse
} }
// Forcibly throw errors for negative HTTP status codes!
// @actions/http-client doesn't do this by default.
// Mimic the errors thrown by Octokit for consistency.
if (response.status >= 400) {
// Try to get an error message from the response body
const errorMsg =
(typeof response.data === 'string' && response.data) ||
response.data?.error ||
response.data?.message ||
// Try the Node HTTP IncomingMessage's statusMessage property
res.message?.statusMessage ||
// Fallback to the HTTP status message based on the status code
HttpStatusMessages[response.status] ||
// Or if the status code is unexpected...
`Unknown error (${response.status})`
throw new RequestError(errorMsg, response.status, {
response,
request: requestOptions
})
}
return response return response
} }
async function getSignedArtifactMetadata({ runtimeToken, workflowRunId, artifactName }) { // Mimic the errors thrown by Octokit for consistency.
const { runTimeUrl: RUNTIME_URL } = getContext() function wrapTwirpErrorLikeOctokit(twirpError, requestOptions) {
const artifactExchangeUrl = `${RUNTIME_URL}_apis/pipelines/workflows/${workflowRunId}/artifacts?api-version=6.0-preview` const rawErrorMsg = twirpError?.message || twirpError?.toString() || ''
const statusCodeMatch = rawErrorMsg.match(/Failed request: \((?<statusCode>\d+)\)/)
const statusCode = statusCodeMatch?.groups?.statusCode ?? 500
const httpClient = new hc.HttpClient() // Try to provide the best error message
let data = null const errorMsg =
rawErrorMsg ||
// Fallback to the HTTP status message based on the status code
HttpStatusMessages[statusCode] ||
// Or if the status code is unexpected...
`Unknown error (${statusCode})`
// RequestError is an Octokit-specific class
return new RequestError(errorMsg, statusCode, {
response: {
url: requestOptions.url,
status: statusCode,
headers: {
...requestOptions.headers
},
data: rawErrorMsg ? { message: rawErrorMsg } : ''
},
request: requestOptions
})
}
function getArtifactsServiceOrigin() {
const resultsUrl = process.env.ACTIONS_RESULTS_URL
return resultsUrl ? new URL(resultsUrl).origin : ''
}
async function getArtifactMetadata({ artifactName }) {
const artifactClient = new DefaultArtifactClient()
// Primarily for debugging purposes, accuracy is not critical
const requestOptions = {
method: 'POST',
url: `${getArtifactsServiceOrigin()}/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts`,
headers: {
'content-type': 'application/json'
},
body: {}
}
try { try {
const requestHeaders = { core.info(`Fetching artifact metadata for "${artifactName}" in this workflow run`)
accept: 'application/json',
authorization: `Bearer ${runtimeToken}` let response
} try {
const requestOptions = { const twirpResponse = await artifactClient.listArtifacts()
method: 'GET', response = wrapTwirpResponseLikeOctokit(twirpResponse, requestOptions)
url: artifactExchangeUrl, } catch (twirpError) {
headers: { core.error('Listing artifact metadata failed', twirpError)
...requestHeaders const octokitError = wrapTwirpErrorLikeOctokit(twirpError, requestOptions)
}, throw octokitError
body: null
} }
core.info(`Artifact exchange URL: ${artifactExchangeUrl}`) const filteredArtifacts = response.data.artifacts.filter(artifact => artifact.name === artifactName)
const res = await httpClient.get(artifactExchangeUrl, requestHeaders)
// May throw a RequestError (HttpError) const artifactCount = filteredArtifacts.length
const response = await processRuntimeResponse(res, requestOptions) core.debug(`List artifact count: ${artifactCount}`)
data = response.data if (artifactCount === 0) {
core.debug(JSON.stringify(data)) throw new Error(
`No artifacts named "${artifactName}" were found for this workflow run. Ensure artifacts are uploaded with actions/upload-artifact@v4 or later.`
)
} else if (artifactCount > 1) {
throw new Error(
`Multiple artifacts named "${artifactName}" were unexpectedly found for this workflow run. Artifact count is ${artifactCount}.`
)
}
const artifact = filteredArtifacts[0]
core.debug(`Artifact: ${JSON.stringify(artifact)}`)
if (!artifact.size) {
core.warning('Artifact size was not found. Unable to verify if artifact size exceeds the allowed size.')
}
return artifact
} catch (error) { } catch (error) {
core.error('Getting signed artifact URL failed', error) core.error(
throw error 'Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.',
} error
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.'
) )
} throw error
const signedArtifactUrl = `${artifactRawUrl}&%24expand=SignedContent`
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 }) { async function createPagesDeployment({ githubToken, artifactId, buildVersion, idToken, isPreview = false }) {
const octokit = github.getOctokit(githubToken) const octokit = github.getOctokit(githubToken)
const payload = { const payload = {
artifact_url: artifactUrl, artifact_id: artifactId,
pages_build_version: buildVersion, pages_build_version: buildVersion,
oidc_token: idToken oidc_token: idToken
} }
@@ -173,7 +172,7 @@ async function cancelPagesDeployment({ githubToken, deploymentId }) {
} }
module.exports = { module.exports = {
getSignedArtifactMetadata, getArtifactMetadata,
createPagesDeployment, createPagesDeployment,
getPagesDeploymentStatus, getPagesDeploymentStatus,
cancelPagesDeployment cancelPagesDeployment

View File

@@ -3,9 +3,7 @@ const core = require('@actions/core')
// Load variables from Actions runtime // Load variables from Actions runtime
function getRequiredVars() { function getRequiredVars() {
return { return {
runTimeUrl: process.env.ACTIONS_RUNTIME_URL,
workflowRun: process.env.GITHUB_RUN_ID, workflowRun: process.env.GITHUB_RUN_ID,
runTimeToken: process.env.ACTIONS_RUNTIME_TOKEN,
repositoryNwo: process.env.GITHUB_REPOSITORY, repositoryNwo: process.env.GITHUB_REPOSITORY,
buildVersion: process.env.GITHUB_SHA, buildVersion: process.env.GITHUB_SHA,
buildActor: process.env.GITHUB_ACTOR, buildActor: process.env.GITHUB_ACTOR,

View File

@@ -3,7 +3,7 @@ const core = require('@actions/core')
// All variables we need from the runtime are loaded here // All variables we need from the runtime are loaded here
const getContext = require('./context') const getContext = require('./context')
const { const {
getSignedArtifactMetadata, getArtifactMetadata,
createPagesDeployment, createPagesDeployment,
getPagesDeploymentStatus, getPagesDeploymentStatus,
cancelPagesDeployment cancelPagesDeployment
@@ -17,7 +17,6 @@ const temporaryErrorStatus = {
const finalErrorStatus = { const finalErrorStatus = {
deployment_failed: 'Deployment failed, try again later.', deployment_failed: 'Deployment failed, try again later.',
deployment_perms_error: 'Deployment failed. Please ensure that the file permissions are correct.',
deployment_content_failed: 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.', '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_cancelled: 'Deployment cancelled.',
@@ -31,9 +30,7 @@ const SIZE_LIMIT_DESCRIPTION = '1 GB'
class Deployment { class Deployment {
constructor() { constructor() {
const context = getContext() const context = getContext()
this.runTimeUrl = context.runTimeUrl
this.repositoryNwo = context.repositoryNwo this.repositoryNwo = context.repositoryNwo
this.runTimeToken = context.runTimeToken
this.buildVersion = context.buildVersion this.buildVersion = context.buildVersion
this.buildActor = context.buildActor this.buildActor = context.buildActor
this.actionsId = context.actionsId this.actionsId = context.actionsId
@@ -48,8 +45,8 @@ class Deployment {
this.startTime = null this.startTime = null
} }
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages // Call GitHub api to fetch artifacts matching the provided name and deploy to GitHub Pages
// by creating a deployment with that artifact // by creating a deployment with that artifact id
async create(idToken) { async create(idToken) {
if (Number(core.getInput('timeout')) > MAX_TIMEOUT) { if (Number(core.getInput('timeout')) > MAX_TIMEOUT) {
core.warning( core.warning(
@@ -65,11 +62,7 @@ class Deployment {
core.debug(`Action ID: ${this.actionsId}`) core.debug(`Action ID: ${this.actionsId}`)
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`) core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
const artifactData = await getSignedArtifactMetadata({ const artifactData = await getArtifactMetadata({ artifactName: this.artifactName })
runtimeToken: this.runTimeToken,
workflowRunId: this.workflowRun,
artifactName: this.artifactName
})
if (artifactData?.size > ONE_GIGABYTE) { if (artifactData?.size > ONE_GIGABYTE) {
core.warning( core.warning(
@@ -79,7 +72,7 @@ class Deployment {
const deployment = await createPagesDeployment({ const deployment = await createPagesDeployment({
githubToken: this.githubToken, githubToken: this.githubToken,
artifactUrl: artifactData.url, artifactId: artifactData.id,
buildVersion: this.buildVersion, buildVersion: this.buildVersion,
idToken, idToken,
isPreview: this.isPreview isPreview: this.isPreview
@@ -104,14 +97,17 @@ class Deployment {
// build customized error message based on server response // build customized error message based on server response
if (error.response) { if (error.response) {
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. ` let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}.`
if (error.response.headers['x-github-request-id']) {
errorMessage += ` Request ID ${error.response.headers['x-github-request-id']}`
}
if (error.status === 400) { if (error.status === 400) {
errorMessage += `Responded with: ${error.message}` errorMessage += ` Responded with: ${error.message}`
} else if (error.status === 403) { } else if (error.status === 403) {
errorMessage += 'Ensure GITHUB_TOKEN has permission "pages: write".' errorMessage += ' Ensure GITHUB_TOKEN has permission "pages: write".'
} else if (error.status === 404) { } else if (error.status === 404) {
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages` const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
errorMessage += `Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}` errorMessage += ` Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
// If using GHES, add a special note about compatibility // If using GHES, add a special note about compatibility
if (new URL(this.githubServerUrl).hostname.toLowerCase() !== 'github.com') { if (new URL(this.githubServerUrl).hostname.toLowerCase() !== 'github.com') {
errorMessage += errorMessage +=
@@ -119,7 +115,7 @@ class Deployment {
} }
} else if (error.status >= 500) { } else if (error.status >= 500) {
errorMessage += errorMessage +=
'Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.' ' Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.'
} }
throw new Error(errorMessage) throw new Error(errorMessage)
} else { } else {