github-settings-as-code 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cmd/repo-settings.mjs +5 -4
- package/dist/cmd/repo-settings.mjs.map +1 -1
- package/dist/github/actions-settings/api/get-actions-settings.d.mts.map +1 -1
- package/dist/github/actions-settings/api/get-actions-settings.mjs +1 -4
- package/dist/github/actions-settings/api/get-actions-settings.mjs.map +1 -1
- package/dist/github/index.d.mts +0 -1
- package/dist/github/index.d.mts.map +1 -1
- package/dist/github/index.mjs +0 -1
- package/dist/github/index.mjs.map +1 -1
- package/dist/github/pages/api/get-pages-settings.d.mts.map +1 -1
- package/dist/github/pages/api/get-pages-settings.mjs +2 -4
- package/dist/github/pages/api/get-pages-settings.mjs.map +1 -1
- package/dist/github/repository/apply.d.mts.map +1 -1
- package/dist/github/repository/apply.mjs.map +1 -1
- package/dist/github/repository/constants.d.mts +80 -80
- package/dist/github/repository/constants.d.mts.map +1 -1
- package/dist/github/repository/constants.mjs +1 -2
- package/dist/github/repository/constants.mjs.map +1 -1
- package/dist/github/resolve-target-repo.mjs +3 -3
- package/dist/github/resolve-target-repo.mjs.map +1 -1
- package/dist/github/ruleset/constants.d.mts +88 -32
- package/dist/github/ruleset/constants.d.mts.map +1 -1
- package/dist/github/ruleset/constants.mjs +1 -2
- package/dist/github/ruleset/constants.mjs.map +1 -1
- package/dist/github/variables/apply.d.mts.map +1 -1
- package/dist/github/variables/apply.mjs +3 -12
- package/dist/github/variables/apply.mjs.map +1 -1
- package/package.json +52 -69
- package/src/cmd/repo-settings.mts +9 -6
- package/src/github/actions-settings/api/get-actions-settings.mts +1 -8
- package/src/github/index.mts +0 -1
- package/src/github/pages/api/get-pages-settings.mts +2 -6
- package/src/github/repository/apply.mts +2 -1
- package/src/github/repository/constants.mts +1 -5
- package/src/github/resolve-target-repo.mts +3 -3
- package/src/github/ruleset/constants.mts +1 -5
- package/src/github/variables/apply.mts +3 -12
- package/dist/github/upgrade-stale-codec.d.mts +0 -19
- package/dist/github/upgrade-stale-codec.d.mts.map +0 -1
- package/dist/github/upgrade-stale-codec.mjs +0 -20
- package/dist/github/upgrade-stale-codec.mjs.map +0 -1
- package/src/github/upgrade-stale-codec.mts +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-settings-as-code",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
],
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/noshiro-pf/
|
|
11
|
+
"url": "git+https://github.com/noshiro-pf/mono.git",
|
|
12
|
+
"directory": "libs/github-settings-as-code"
|
|
12
13
|
},
|
|
13
14
|
"license": "Apache-2.0",
|
|
14
15
|
"author": "noshiro-pf <noshiro.pf@gmail.com>",
|
|
@@ -23,87 +24,35 @@
|
|
|
23
24
|
"README.md",
|
|
24
25
|
"LICENSE"
|
|
25
26
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"agents:gen": "tsx ./scripts/cmd/gen-agents-md.mts",
|
|
28
|
-
"agents:sync": "tsx ./scripts/cmd/sync-agent-config.mts",
|
|
29
|
-
"build": "tsx ./scripts/cmd/build.mts",
|
|
30
|
-
"build:min": "tsx ./scripts/cmd/build.mts --skip-check",
|
|
31
|
-
"check:ext": "tsx ./scripts/cmd/check-ext.mts",
|
|
32
|
-
"check-all": "tsx ./scripts/cmd/check-all.mts",
|
|
33
|
-
"codemod": "run-s codemod:uncommitted:as-const fmt codemod:uncommitted:readonly fmt",
|
|
34
|
-
"codemod:diff": "run-s codemod:diff:as-const fmt codemod:diff:readonly fmt",
|
|
35
|
-
"codemod:diff:as-const": "append-as-const --diff-from origin/main '{src,scripts,samples}/**/*.mts'",
|
|
36
|
-
"codemod:diff:readonly": "convert-to-readonly --diff-from origin/main '{src,scripts,samples}/**/*.mts'",
|
|
37
|
-
"codemod:full": "run-s codemod:full:as-const fmt codemod:full:readonly fmt",
|
|
38
|
-
"codemod:full:as-const": "append-as-const '{src,scripts,samples}/**/*.mts'",
|
|
39
|
-
"codemod:full:readonly": "convert-to-readonly '{src,scripts,samples}/**/*.mts'",
|
|
40
|
-
"codemod:uncommitted:as-const": "append-as-const --uncommitted '{src,scripts,samples}/**/*.mts'",
|
|
41
|
-
"codemod:uncommitted:readonly": "convert-to-readonly --uncommitted '{src,scripts,samples}/**/*.mts'",
|
|
42
|
-
"cspell": "cspell \"{**,.changeset/**/*,.github/**/*}\" --gitignore --gitignore-root ./ --no-progress",
|
|
43
|
-
"doc": "tsx ./scripts/cmd/gen-docs.mts",
|
|
44
|
-
"fmt": "format-uncommitted",
|
|
45
|
-
"fmt:diff": "format-diff-from origin/main",
|
|
46
|
-
"fmt:full": "prettier --write .",
|
|
47
|
-
"gi": "run-s gi:src fmt",
|
|
48
|
-
"gi:src": "gen-index-ts ./src/github --index-ext .mts --export-ext .mjs --target-ext .mts --exclude cmd --exclude octokit.mts",
|
|
49
|
-
"lint": "eslint .",
|
|
50
|
-
"lint:fix": "eslint . --fix",
|
|
51
|
-
"md": "markdownlint-cli2",
|
|
52
|
-
"repo-settings:apply": "tsx ./src/cmd/repo-settings.mts apply",
|
|
53
|
-
"repo-settings:backup": "tsx ./src/cmd/repo-settings.mts backup",
|
|
54
|
-
"test": "pnpm run z:vitest:node run",
|
|
55
|
-
"test:cov": "pnpm run z:vitest:node run --coverage",
|
|
56
|
-
"test:cov:ui": "vite preview --outDir ./coverage",
|
|
57
|
-
"test:ui": "pnpm run z:vitest:node --ui",
|
|
58
|
-
"testw": "pnpm run z:vitest:node watch",
|
|
59
|
-
"tsc": "node ./node_modules/typescript-native/bin/tsc --noEmit",
|
|
60
|
-
"tscw": "node ./node_modules/typescript-native/bin/tsc --noEmit --watch -p ./tsconfig.json",
|
|
61
|
-
"type-check": "node ./node_modules/typescript-native/bin/tsc --noEmit",
|
|
62
|
-
"z:vitest": "vitest --config ./configs/vitest.config.mts",
|
|
63
|
-
"z:vitest:node": "pnpm run z:vitest --project='Node.js'"
|
|
64
|
-
},
|
|
65
27
|
"dependencies": {
|
|
66
|
-
"@octokit/core": "^7.0.
|
|
28
|
+
"@octokit/core": "^7.0.7",
|
|
67
29
|
"dotenv": "^17.4.2",
|
|
68
|
-
"octokit-safe-types": "^1.2.
|
|
69
|
-
"ts-data-forge": "^
|
|
70
|
-
"ts-fortress": "^
|
|
71
|
-
"ts-
|
|
30
|
+
"octokit-safe-types": "^1.2.25",
|
|
31
|
+
"ts-data-forge": "^14.2.1",
|
|
32
|
+
"ts-fortress": "^12.0.1",
|
|
33
|
+
"ts-repo-utils": "^10.2.0",
|
|
34
|
+
"ts-type-forge": "^9.2.1"
|
|
72
35
|
},
|
|
73
36
|
"devDependencies": {
|
|
74
|
-
"@
|
|
75
|
-
"@semantic-release/commit-analyzer": "13.0.1",
|
|
76
|
-
"@semantic-release/exec": "7.1.0",
|
|
77
|
-
"@semantic-release/git": "11.0.1",
|
|
78
|
-
"@semantic-release/github": "12.0.9",
|
|
79
|
-
"@semantic-release/npm": "13.1.5",
|
|
80
|
-
"@semantic-release/release-notes-generator": "14.1.1",
|
|
81
|
-
"@types/node": "26.1.2",
|
|
37
|
+
"@types/node": "26.2.0",
|
|
82
38
|
"@vitest/coverage-v8": "4.1.10",
|
|
83
39
|
"@vitest/ui": "4.1.10",
|
|
84
|
-
"conventional-changelog-conventionalcommits": "10.2.1",
|
|
85
40
|
"cspell": "10.0.1",
|
|
86
41
|
"eslint": "10.8.0",
|
|
87
|
-
"eslint-config-typed": "5.8.2",
|
|
88
42
|
"jiti": "2.7.0",
|
|
89
|
-
"
|
|
90
|
-
"markdownlint-cli2": "0.23.2",
|
|
91
|
-
"npm-run-all2": "9.0.2",
|
|
92
|
-
"playwright": "1.62.0",
|
|
43
|
+
"npm-run-all2": "9.0.3",
|
|
93
44
|
"prettier": "3.9.6",
|
|
94
45
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
95
46
|
"prettier-plugin-packagejson": "3.0.2",
|
|
96
|
-
"
|
|
97
|
-
"ts-codemod-lib": "2.2.3",
|
|
98
|
-
"ts-repo-utils": "10.1.6",
|
|
99
|
-
"tsx": "4.23.1",
|
|
100
|
-
"typedoc": "0.28.20",
|
|
101
|
-
"typedoc-github-theme": "0.4.0",
|
|
47
|
+
"tsx": "4.23.4",
|
|
102
48
|
"typescript": "6.0.3",
|
|
103
49
|
"typescript-native": "npm:typescript@7.0.2",
|
|
104
|
-
"vitest": "4.1.10"
|
|
50
|
+
"vitest": "4.1.10",
|
|
51
|
+
"eslint-config-typed": "5.8.5",
|
|
52
|
+
"eslint-plugin-ts-data-forge": "0.4.4",
|
|
53
|
+
"eslint-plugin-ts-fortress": "1.0.1",
|
|
54
|
+
"eslint-plugin-ts-type-forge": "0.6.3"
|
|
105
55
|
},
|
|
106
|
-
"packageManager": "pnpm@11.20.0",
|
|
107
56
|
"engines": {
|
|
108
57
|
"node": ">=22.22.2",
|
|
109
58
|
"pnpm": ">=9.0.0"
|
|
@@ -114,5 +63,39 @@
|
|
|
114
63
|
"publishConfig": {
|
|
115
64
|
"access": "public",
|
|
116
65
|
"provenance": true
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/build.mts",
|
|
69
|
+
"build:min": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/build.mts --skip-check",
|
|
70
|
+
"check:ext": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-ext.mts",
|
|
71
|
+
"check-all": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-all.mts",
|
|
72
|
+
"codemod": "run-s codemod:uncommitted:as-const fmt codemod:uncommitted:readonly fmt",
|
|
73
|
+
"codemod:diff": "run-s codemod:diff:as-const fmt codemod:diff:readonly fmt",
|
|
74
|
+
"codemod:diff:as-const": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/append-as-const.mts --diff-from origin/main '{src,scripts,samples}/**/*.mts'",
|
|
75
|
+
"codemod:diff:readonly": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/convert-to-readonly.mts --diff-from origin/main '{src,scripts,samples}/**/*.mts'",
|
|
76
|
+
"codemod:full": "run-s codemod:full:as-const fmt codemod:full:readonly fmt",
|
|
77
|
+
"codemod:full:as-const": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/append-as-const.mts '{src,scripts,samples}/**/*.mts'",
|
|
78
|
+
"codemod:full:readonly": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/convert-to-readonly.mts '{src,scripts,samples}/**/*.mts'",
|
|
79
|
+
"codemod:uncommitted:as-const": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/append-as-const.mts --uncommitted '{src,scripts,samples}/**/*.mts'",
|
|
80
|
+
"codemod:uncommitted:readonly": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/convert-to-readonly.mts --uncommitted '{src,scripts,samples}/**/*.mts'",
|
|
81
|
+
"cspell": "cspell \"**\" --gitignore --gitignore-root ../../ --no-progress",
|
|
82
|
+
"doc": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/gen-docs.mts",
|
|
83
|
+
"fmt": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/format-uncommitted.mts --cwd .",
|
|
84
|
+
"fmt:diff": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/format-diff-from.mts origin/main --cwd .",
|
|
85
|
+
"fmt:full": "prettier --write .",
|
|
86
|
+
"gi": "run-s gi:src fmt",
|
|
87
|
+
"gi:src": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/gen-index-ts.mts ./src/github --index-ext .mts --export-ext .mjs --target-ext .mts --exclude cmd --exclude octokit.mts",
|
|
88
|
+
"lint": "eslint .",
|
|
89
|
+
"lint:fix": "eslint . --fix",
|
|
90
|
+
"test": "pnpm run z:vitest:node run",
|
|
91
|
+
"test:cov": "pnpm run z:vitest:node run --coverage",
|
|
92
|
+
"test:cov:ui": "vite preview --outDir ./coverage",
|
|
93
|
+
"test:ui": "pnpm run z:vitest:node --ui",
|
|
94
|
+
"testw": "pnpm run z:vitest:node watch",
|
|
95
|
+
"tsc": "node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
96
|
+
"tscw": "node ../../node_modules/typescript-native/bin/tsc --noEmit --watch -p ./tsconfig.json",
|
|
97
|
+
"type-check": "node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
98
|
+
"z:vitest": "vitest --config ./configs/vitest.config.mts",
|
|
99
|
+
"z:vitest:node": "pnpm run z:vitest --project='Node.js'"
|
|
117
100
|
}
|
|
118
|
-
}
|
|
101
|
+
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import 'dotenv/config';
|
|
4
4
|
import * as util from 'node:util';
|
|
5
|
+
import { Arr } from 'ts-data-forge';
|
|
6
|
+
import { type ReadonlyRecord } from 'ts-type-forge';
|
|
5
7
|
|
|
6
8
|
const HELP = `
|
|
7
9
|
Usage: repo-settings <command> [target] [options]
|
|
@@ -76,7 +78,7 @@ const fail: (message: string) => never = (message) => {
|
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
const { values, positionals } = util.parseArgs({
|
|
79
|
-
args: process.argv
|
|
81
|
+
args: Arr.skip(process.argv, 2),
|
|
80
82
|
options: {
|
|
81
83
|
owner: { type: 'string' },
|
|
82
84
|
repo: { type: 'string' },
|
|
@@ -86,10 +88,10 @@ const { values, positionals } = util.parseArgs({
|
|
|
86
88
|
allowPositionals: true,
|
|
87
89
|
});
|
|
88
90
|
|
|
89
|
-
if (values.help === true || positionals
|
|
90
|
-
console.
|
|
91
|
+
if (values.help === true || Arr.isEmpty(positionals)) {
|
|
92
|
+
console.info(HELP);
|
|
91
93
|
|
|
92
|
-
process.exit(positionals
|
|
94
|
+
process.exit(Arr.isEmpty(positionals) ? 1 : 0);
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
const [commandArg, targetArg = 'all'] = positionals;
|
|
@@ -106,8 +108,9 @@ if (!isTarget(targetArg)) {
|
|
|
106
108
|
// 走るため、 --help や引数エラーの時点では評価させたくない。
|
|
107
109
|
const github = await import('../github/index.mjs');
|
|
108
110
|
|
|
109
|
-
const runners:
|
|
110
|
-
|
|
111
|
+
const runners: ReadonlyRecord<
|
|
112
|
+
Command,
|
|
113
|
+
Partial<ReadonlyRecord<Target, () => Promise<void>>>
|
|
111
114
|
> = {
|
|
112
115
|
apply: {
|
|
113
116
|
all: async () => {
|
|
@@ -21,18 +21,11 @@ export const getActionsSettings = async (): Promise<ActionsSettings> => {
|
|
|
21
21
|
{ owner: OWNER, repo: REPO, headers: octokitHeaders },
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
-
// sha_pinning_required は @octokit/types v16 の型に無いため、レスポンスから
|
|
25
|
-
// 直接読まずに validate 側の既定値へフォールバックさせる。
|
|
26
|
-
const shaPinningRequired: unknown = (
|
|
27
|
-
permissions.data as Readonly<Record<string, unknown>>
|
|
28
|
-
)['sha_pinning_required'];
|
|
29
|
-
|
|
30
24
|
// eslint-disable-next-line unicorn/no-array-fill-with-reference-type
|
|
31
25
|
return ActionsSettings.fill({
|
|
32
26
|
enabled: permissions.data.enabled,
|
|
33
27
|
allowed_actions: permissions.data.allowed_actions,
|
|
34
|
-
sha_pinning_required:
|
|
35
|
-
typeof shaPinningRequired === 'boolean' ? shaPinningRequired : undefined,
|
|
28
|
+
sha_pinning_required: permissions.data.sha_pinning_required,
|
|
36
29
|
fork_pr_contributor_approval_policy: forkPrApproval.data.approval_policy,
|
|
37
30
|
});
|
|
38
31
|
};
|
package/src/github/index.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EndpointKeys } from 'octokit-safe-types';
|
|
2
|
+
import { hasKey, isRecord } from 'ts-data-forge';
|
|
2
3
|
import { octokitHeaders, OWNER, REPO } from '../../constants.mjs';
|
|
3
4
|
import { octokit } from '../../octokit.mjs';
|
|
4
5
|
import { PagesSettings } from '../constants.mjs';
|
|
@@ -21,12 +22,7 @@ export const getPagesSettings = async (): Promise<
|
|
|
21
22
|
// eslint-disable-next-line unicorn/no-array-fill-with-reference-type
|
|
22
23
|
return PagesSettings.fill({ build_type: response.data.build_type });
|
|
23
24
|
} catch (error) {
|
|
24
|
-
if (
|
|
25
|
-
typeof error === 'object' &&
|
|
26
|
-
error !== null &&
|
|
27
|
-
Object.hasOwn(error, 'status') &&
|
|
28
|
-
(error as Readonly<{ status?: unknown }>).status === 404
|
|
29
|
-
) {
|
|
25
|
+
if (isRecord(error) && hasKey(error, 'status') && error.status === 404) {
|
|
30
26
|
return undefined;
|
|
31
27
|
}
|
|
32
28
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
isDirectlyExecuted,
|
|
11
11
|
Result,
|
|
12
12
|
} from 'ts-repo-utils';
|
|
13
|
+
import { type StrictPick } from 'ts-type-forge';
|
|
13
14
|
import { repositorySettingsDir, settingsJsonName } from '../constants.mjs';
|
|
14
15
|
import { getRepositorySettings, updateRepository } from './api/index.mjs';
|
|
15
16
|
import { backupRepositorySettings } from './backup.mjs';
|
|
@@ -52,7 +53,7 @@ export const applyRepositorySettings = async (): Promise<void> => {
|
|
|
52
53
|
// NOTE: "RequestError [HttpError]: Allow forks can only be changed on org-owned repositories"
|
|
53
54
|
// allow_forking: settings.allow_forking,
|
|
54
55
|
web_commit_signoff_required: settings.web_commit_signoff_required,
|
|
55
|
-
} satisfies
|
|
56
|
+
} satisfies StrictPick<UpdateRepositoryRequest, RepositoryKeysToPick>,
|
|
56
57
|
});
|
|
57
58
|
|
|
58
59
|
// update local setting file
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
import { expectType } from 'ts-data-forge';
|
|
6
6
|
import * as t from 'ts-fortress';
|
|
7
7
|
import { type StrictExclude } from 'ts-type-forge';
|
|
8
|
-
import { upgradeStaleCodec } from '../upgrade-stale-codec.mjs';
|
|
9
8
|
|
|
10
9
|
const keysToPickBase = [
|
|
11
10
|
'allow_auto_merge',
|
|
@@ -64,9 +63,6 @@ export type RepositoryKeysToPick = StrictExclude<
|
|
|
64
63
|
|
|
65
64
|
expectType<keyof UpdateRepositoryRequest, RepositoryKeysToPick>('>=');
|
|
66
65
|
|
|
67
|
-
export const RepositoryPicked = t.pick(
|
|
68
|
-
upgradeStaleCodec(FullRepository),
|
|
69
|
-
repositoryKeysToPick,
|
|
70
|
-
);
|
|
66
|
+
export const RepositoryPicked = t.pick(FullRepository, repositoryKeysToPick);
|
|
71
67
|
|
|
72
68
|
export type RepositoryPicked = t.TypeOf<typeof RepositoryPicked>;
|
|
@@ -2,7 +2,7 @@ import { execFileSync } from 'node:child_process';
|
|
|
2
2
|
import * as fs from 'node:fs/promises';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import * as util from 'node:util';
|
|
5
|
-
import { hasKey, isRecord, isString, Json } from 'ts-data-forge';
|
|
5
|
+
import { Arr, hasKey, isRecord, isString, Json } from 'ts-data-forge';
|
|
6
6
|
import { Result } from 'ts-repo-utils';
|
|
7
7
|
|
|
8
8
|
export type TargetRepo = Readonly<{
|
|
@@ -12,7 +12,7 @@ export type TargetRepo = Readonly<{
|
|
|
12
12
|
|
|
13
13
|
/** `strict: false` の解析結果は string | boolean | 配列 になりうるため絞り込む。 */
|
|
14
14
|
const pickString = (value: unknown): string | undefined =>
|
|
15
|
-
|
|
15
|
+
value !== '' && isString(value) ? value : undefined;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* コマンドライン引数から `--owner` / `--repo` を読む。
|
|
@@ -21,7 +21,7 @@ const pickString = (value: unknown): string | undefined =>
|
|
|
21
21
|
*/
|
|
22
22
|
const fromCliArgs = (): Partial<TargetRepo> => {
|
|
23
23
|
const { values } = util.parseArgs({
|
|
24
|
-
args: process.argv
|
|
24
|
+
args: Arr.skip(process.argv, 2),
|
|
25
25
|
options: {
|
|
26
26
|
owner: { type: 'string' },
|
|
27
27
|
repo: { type: 'string' },
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
} from 'octokit-safe-types';
|
|
6
6
|
import { expectType } from 'ts-data-forge';
|
|
7
7
|
import * as t from 'ts-fortress';
|
|
8
|
-
import { upgradeStaleCodec } from '../upgrade-stale-codec.mjs';
|
|
9
8
|
|
|
10
9
|
export const rulesetKeysToPick = [
|
|
11
10
|
'id',
|
|
@@ -23,9 +22,6 @@ expectType<keyof UpdateRulesetRequest | 'id', KeysToPick>('=');
|
|
|
23
22
|
|
|
24
23
|
expectType<keyof CreateRulesetRequest, keyof UpdateRulesetRequest>('=');
|
|
25
24
|
|
|
26
|
-
export const RulesetPicked = t.pick(
|
|
27
|
-
upgradeStaleCodec(RepositoryRuleset),
|
|
28
|
-
rulesetKeysToPick,
|
|
29
|
-
);
|
|
25
|
+
export const RulesetPicked = t.pick(RepositoryRuleset, rulesetKeysToPick);
|
|
30
26
|
|
|
31
27
|
export type RulesetPicked = t.TypeOf<typeof RulesetPicked>;
|
|
@@ -9,16 +9,6 @@ import {
|
|
|
9
9
|
|
|
10
10
|
export const applyVariables = async (): Promise<void> => {
|
|
11
11
|
const variables = [
|
|
12
|
-
{
|
|
13
|
-
// noshiro-semantic-release-bot (App ID: 1442563)
|
|
14
|
-
name: 'SEMANTIC_RELEASE_BOT_CLIENT_ID',
|
|
15
|
-
value: 'Iv23liAmv2bgTYTkv2pt',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
// noshiro-changesets-release-bot (App ID: 1576218)
|
|
19
|
-
name: 'CHANGESETS_RELEASE_BOT_CLIENT_ID',
|
|
20
|
-
value: 'Iv23limuZKrTEcXmN0lp',
|
|
21
|
-
},
|
|
22
12
|
{
|
|
23
13
|
// noshiro-repo-settings-bot (App ID: 4476573)
|
|
24
14
|
// Administration を含む強い権限を持つ。設定の backup / apply 専用。
|
|
@@ -27,8 +17,9 @@ export const applyVariables = async (): Promise<void> => {
|
|
|
27
17
|
},
|
|
28
18
|
{
|
|
29
19
|
// noshiro-repo-automation-bot (App ID: 4478721)
|
|
30
|
-
// Contents / Pull requests
|
|
31
|
-
// sync-agent-config
|
|
20
|
+
// Contents / Pull requests / Issues 権限。PR を作る自動化( pnpm-update /
|
|
21
|
+
// sync-agent-config )と release で共用する。実際に使う権限は各
|
|
22
|
+
// ワークフローの permission-* 入力で絞る。
|
|
32
23
|
name: 'REPO_AUTOMATION_BOT_CLIENT_ID',
|
|
33
24
|
value: 'Iv23lilpiDh0twq2PErv',
|
|
34
25
|
},
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type Type } from 'ts-fortress';
|
|
2
|
-
import { type StrictOmit } from 'ts-type-forge';
|
|
3
|
-
/**
|
|
4
|
-
* Restores the full ts-fortress `Type` interface for codecs imported from
|
|
5
|
-
* octokit-safe-types@1.2.19, whose declaration files were generated against
|
|
6
|
-
* ts-fortress 7 (whose `Type` lacked the `prune` member). The pnpm override in
|
|
7
|
-
* `pnpm-workspace.yaml` resolves ts-fortress >= 11 at runtime, so the codec
|
|
8
|
-
* object itself does have `prune`; only its declared type is stale. This
|
|
9
|
-
* verifies `prune` exists at runtime and rebuilds the codec with the correct
|
|
10
|
-
* type, without unsafe type assertions.
|
|
11
|
-
*
|
|
12
|
-
* TODO: Remove this helper once octokit-safe-types is rebuilt against
|
|
13
|
-
* ts-fortress >= 11.
|
|
14
|
-
*/
|
|
15
|
-
export declare const upgradeStaleCodec: <A>(codec: Readonly<{
|
|
16
|
-
defaultValue: A;
|
|
17
|
-
prune?: Type<A>['prune'];
|
|
18
|
-
}> & StrictOmit<Type<A>, 'defaultValue' | 'prune'>) => Type<A>;
|
|
19
|
-
//# sourceMappingURL=upgrade-stale-codec.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-stale-codec.d.mts","sourceRoot":"","sources":["../../src/github/upgrade-stale-codec.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAC1B,QAAQ,CAAC;IAAE,YAAY,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,GAC5D,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,KAC9C,IAAI,CAAC,CAAC,CAUR,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Restores the full ts-fortress `Type` interface for codecs imported from
|
|
3
|
-
* octokit-safe-types@1.2.19, whose declaration files were generated against
|
|
4
|
-
* ts-fortress 7 (whose `Type` lacked the `prune` member). The pnpm override in
|
|
5
|
-
* `pnpm-workspace.yaml` resolves ts-fortress >= 11 at runtime, so the codec
|
|
6
|
-
* object itself does have `prune`; only its declared type is stale. This
|
|
7
|
-
* verifies `prune` exists at runtime and rebuilds the codec with the correct
|
|
8
|
-
* type, without unsafe type assertions.
|
|
9
|
-
*
|
|
10
|
-
* TODO: Remove this helper once octokit-safe-types is rebuilt against
|
|
11
|
-
* ts-fortress >= 11.
|
|
12
|
-
*/
|
|
13
|
-
export const upgradeStaleCodec = (codec) => {
|
|
14
|
-
const { prune } = codec;
|
|
15
|
-
if (prune === undefined) {
|
|
16
|
-
throw new Error(`The codec "${codec.typeName}" has no prune function at runtime. octokit-safe-types is probably resolving an old ts-fortress version; check the pnpm overrides.`);
|
|
17
|
-
}
|
|
18
|
-
return { ...codec, prune };
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=upgrade-stale-codec.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-stale-codec.mjs","sourceRoot":"","sources":["../../src/github/upgrade-stale-codec.mts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAC+C,EACtC,EAAE;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAExB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,cAAc,KAAK,CAAC,QAAQ,oIAAoI,CACjK,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type Type } from 'ts-fortress';
|
|
2
|
-
import { type StrictOmit } from 'ts-type-forge';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Restores the full ts-fortress `Type` interface for codecs imported from
|
|
6
|
-
* octokit-safe-types@1.2.19, whose declaration files were generated against
|
|
7
|
-
* ts-fortress 7 (whose `Type` lacked the `prune` member). The pnpm override in
|
|
8
|
-
* `pnpm-workspace.yaml` resolves ts-fortress >= 11 at runtime, so the codec
|
|
9
|
-
* object itself does have `prune`; only its declared type is stale. This
|
|
10
|
-
* verifies `prune` exists at runtime and rebuilds the codec with the correct
|
|
11
|
-
* type, without unsafe type assertions.
|
|
12
|
-
*
|
|
13
|
-
* TODO: Remove this helper once octokit-safe-types is rebuilt against
|
|
14
|
-
* ts-fortress >= 11.
|
|
15
|
-
*/
|
|
16
|
-
export const upgradeStaleCodec = <A,>(
|
|
17
|
-
codec: Readonly<{ defaultValue: A; prune?: Type<A>['prune'] }> &
|
|
18
|
-
StrictOmit<Type<A>, 'defaultValue' | 'prune'>,
|
|
19
|
-
): Type<A> => {
|
|
20
|
-
const { prune } = codec;
|
|
21
|
-
|
|
22
|
-
if (prune === undefined) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
`The codec "${codec.typeName}" has no prune function at runtime. octokit-safe-types is probably resolving an old ts-fortress version; check the pnpm overrides.`,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return { ...codec, prune };
|
|
29
|
-
};
|