Skip to content

Commit 088073e

Browse files
authored
Update fix-yaml-config.ts
1 parent 9fcc7a0 commit 088073e

File tree

1 file changed

+51
-29
lines changed

1 file changed

+51
-29
lines changed

scripts/src/actions/fix-yaml-config.ts

+51-29
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import {doNotEnforceAdmins} from './do-not-enforce-admins'
66
import {addFileToAllRepos} from './shared/add-file-to-all-repos'
77
import {format} from './shared/format'
88
import {setPropertyInAllRepos} from './shared/set-property-in-all-repos'
9+
import {toggleArchivedRepos} from './shared/toggle-archived-repos'
10+
import {describeAccessChanges} from './shared/describe-access-changes'
11+
12+
import * as core from '@actions/core'
913

1014
function isInitialised(repository: Repository) {
1115
return ![
@@ -30,32 +34,50 @@ function isFork(repository: Repository) {
3034
].includes(repository.name)
3135
}
3236

33-
addFileToAllRepos(
34-
'.github/workflows/stale.yml',
35-
'.github/workflows/stale.yml',
36-
r => isInitialised(r) && !isFork(r)
37-
)
38-
39-
addFileToAllRepos(
40-
'.github/pull_request_template.md',
41-
'.github/helia_pull_request_template.md',
42-
r => isInitialised(r) && isHelia(r)
43-
)
44-
45-
setPropertyInAllRepos(
46-
'secret_scanning',
47-
true,
48-
r => isInitialised(r) && isPublic(r)
49-
)
50-
setPropertyInAllRepos(
51-
'secret_scanning_push_protection',
52-
true,
53-
r => isInitialised(r) && isPublic(r)
54-
)
55-
doNotEnforceAdmins(
56-
(repository: Repository, rule: RepositoryBranchProtectionRule) =>
57-
isInitialised(repository) &&
58-
repository.default_branch !== undefined &&
59-
globToRegex(rule.pattern).test(repository.default_branch)
60-
)
61-
format()
37+
async function run() {
38+
await addFileToAllRepos(
39+
'.github/workflows/stale.yml',
40+
'.github/workflows/stale.yml',
41+
r => isInitialised(r) && !isFork(r)
42+
)
43+
44+
await addFileToAllRepos(
45+
'.github/pull_request_template.md',
46+
'.github/helia_pull_request_template.md',
47+
r => isInitialised(r) && isHelia(r)
48+
)
49+
50+
await setPropertyInAllRepos(
51+
'secret_scanning',
52+
true,
53+
r => isInitialised(r) && isPublic(r)
54+
)
55+
await setPropertyInAllRepos(
56+
'secret_scanning_push_protection',
57+
true,
58+
r => isInitialised(r) && isPublic(r)
59+
)
60+
await doNotEnforceAdmins(
61+
(repository: Repository, rule: RepositoryBranchProtectionRule) =>
62+
isInitialised(repository) &&
63+
repository.default_branch !== undefined &&
64+
globToRegex(rule.pattern).test(repository.default_branch)
65+
)
66+
await toggleArchivedRepos()
67+
const accessChangesDescription = await describeAccessChanges()
68+
core.setOutput(
69+
'comment',
70+
`The following access changes will be introduced as a result of applying the plan:
71+
72+
<details><summary>Access Changes</summary>
73+
74+
\`\`\`
75+
${accessChangesDescription}
76+
\`\`\`
77+
78+
</details>`
79+
)
80+
await format()
81+
}
82+
83+
run()

0 commit comments

Comments
 (0)