Skip to content

Commit 8abd048

Browse files
authored
Merge pull request #110 from ysk8hori/update-updateworkflowfiles-script
octkit による問い合わせのリトライやエラー周りの改善のビルド
2 parents a276eff + b06e50e commit 8abd048

File tree

9 files changed

+210981
-192129
lines changed

9 files changed

+210981
-192129
lines changed

.github/workflows/test-no-params.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
14-
- uses: ysk8hori/delta-typescript-graph-action@0670bfc709ebca2cb3ed627f2148801a8183ae7e
14+
- uses: ysk8hori/delta-typescript-graph-action@8a2cbbc7174f752bfcfb07466f1414cbc115ae12

.github/workflows/test-with-params.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
1414
- name: Delta Typescript Graph
1515
id: tsg
16-
uses: ysk8hori/delta-typescript-graph-action@0670bfc709ebca2cb3ed627f2148801a8183ae7e
16+
uses: ysk8hori/delta-typescript-graph-action@8a2cbbc7174f752bfcfb07466f1414cbc115ae12
1717
with:
1818
access-token: ${{ secrets.GITHUB_TOKEN }}
1919
tsconfig-root: './src'

dist/index.js

Lines changed: 210896 additions & 192101 deletions
Large diffs are not rendered by default.

dist/licenses.txt

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ The above copyright notice and this permission notice shall be included in all c
1010

1111
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.
1212

13+
@actions/exec
14+
MIT
15+
The MIT License (MIT)
16+
17+
Copyright 2019 GitHub
18+
19+
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:
20+
21+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22+
23+
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.
24+
1325
@actions/github
1426
MIT
1527
The MIT License (MIT)
@@ -47,6 +59,18 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
4759
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4860

4961

62+
@actions/io
63+
MIT
64+
The MIT License (MIT)
65+
66+
Copyright 2019 GitHub
67+
68+
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:
69+
70+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
71+
72+
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.
73+
5074
@fastify/busboy
5175
MIT
5276
Copyright Brian White. All rights reserved.
@@ -739,19 +763,6 @@ Permission to use, copy, modify, and/or distribute this software for any purpose
739763
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
740764

741765

742-
uuid
743-
MIT
744-
The MIT License (MIT)
745-
746-
Copyright (c) 2010-2020 Robert Kieffer and other contributors
747-
748-
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:
749-
750-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
751-
752-
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.
753-
754-
755766
wrappy
756767
ISC
757768
The ISC License

package-lock.json

Lines changed: 42 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "jest",
8-
"build": "tsc & ncc build lib/index.js --license licenses.txt",
9-
"build2": "ncc build src/index.ts --license licenses.txt",
8+
"build": "ncc build src/index.ts --license licenses.txt",
109
"type-check": "tsc --noEmit",
1110
"prettier": "prettier --write ./src",
1211
"lint:fix": "eslint --fix src",
@@ -29,7 +28,8 @@
2928
"jest": "29.7.0",
3029
"prettier": "3.3.3",
3130
"ts-jest": "29.2.5",
32-
"typescript": "5.6.2"
31+
"typescript": "5.6.2",
32+
"zx": "8.1.9"
3333
},
3434
"dependencies": {
3535
"@actions/core": "1.11.1",

scripts/update-workflowfiles.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
/**
2-
* This script updates the workflow files in the .github/workflows directory.
2+
* GitHub Action を公開する際には、 /dist/index.js をビルドしてコミットする必要がある。それが Action の実体となる。
3+
* それをコミットしたうえで、本リポジトリの CI のテストにおいてはそのコミットハッシュを使用するようワークフローファイルを更新してコミットする。
34
*
4-
* workflow の中の ysk8hori/delta-typescript-graph-action のバージョンを、現在のブランチにおける最新のコミットハッシュに更新する。
5+
* When publishing a GitHub Action, it is necessary to build and commit `/dist/index.js`, as it serves as the actual implementation of the Action.
6+
* After committing that, in the CI test of this repository, update the workflow file to use the commit hash and commit the changes.
57
*/
68

79
import fs from 'fs';
810
import path from 'path';
9-
import { execSync } from 'child_process';
11+
import { $ } from 'zx';
1012

11-
const headSha = execSync('git rev-parse HEAD').toString().trim();
13+
await $`npm run build`;
14+
await $`git commit -am "chore: update dist"`;
15+
16+
const headSha = (await $`git rev-parse HEAD`).toString().trim();
1217
const files = fs.readdirSync(path.resolve('.github/workflows'));
1318
files.forEach(file => {
1419
const filePath = path.resolve('.github/workflows', file);
@@ -19,3 +24,5 @@ files.forEach(file => {
1924
);
2025
fs.writeFileSync(filePath, updatedContent);
2126
});
27+
28+
await $`git commit -am "ci: update hash"`;

src/utils/github.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import { retry } from './retry';
1515
function throwUnexpectedError(e: any) {
1616
// @see https://github.com/octokit/plugin-retry.js
1717
if ([400, 401, 403, 404, 422, 451].includes(e?.status)) {
18-
log(e);
18+
console.warn(e);
1919
return undefined;
2020
}
21-
const error = new Error();
22-
error.cause = e;
23-
throw error;
21+
throw new Error(e.message, { cause: e });
2422
}
2523

2624
export default class GitHub {

src/utils/retry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function retry<T>(
44
interval = 1000,
55
): Promise<T | undefined> {
66
return fn().catch(async (error: Error) => {
7-
console.warn(error);
7+
console.warn('\n', error);
88
if (maxRetries <= 0) return undefined;
99

1010
await new Promise(resolve => setTimeout(resolve, interval));

0 commit comments

Comments
 (0)