Skip to content

Commit 0113ea0

Browse files
fix: use repo settings in more hydration areas (#477)
## PR Checklist - [x] Addresses an existing open issue: fixes #474 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Passes through `owner` and `repository` in a couple more places.
1 parent 59b6380 commit 0113ea0

File tree

4 files changed

+26
-30
lines changed

4 files changed

+26
-30
lines changed

src/hydrate/creation/dotGitHub/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { createWorkflows } from "./workflows.js";
66

77
export function createDotGitHub(settings: RepositorySettings) {
88
return {
9-
ISSUE_TEMPLATE: createDotGitHubIssueTemplate(),
9+
ISSUE_TEMPLATE: createDotGitHubIssueTemplate(settings),
1010
actions: createDotGitHubActions(),
11-
workflows: createWorkflows(),
11+
workflows: createWorkflows(settings),
1212
...createDotGitHubFiles(settings),
1313
};
1414
}

src/hydrate/creation/dotGitHub/issueTemplate.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
import { RepositorySettings } from "../../repositorySettings.js";
12
import { formatYaml } from "../formatters/formatYaml.js";
23

3-
export function createDotGitHubIssueTemplate() {
4+
export function createDotGitHubIssueTemplate({
5+
owner,
6+
repository,
7+
}: Pick<RepositorySettings, "owner" | "repository">) {
48
return {
59
"01-bug.yml": formatYaml({
610
body: [
@@ -20,8 +24,7 @@ export function createDotGitHubIssueTemplate() {
2024
required: true,
2125
},
2226
{
23-
label:
24-
"I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.",
27+
label: `I have [searched for related issues](https://github.com/${owner}/${repository}/issues?q=is%3Aissue) and found none that matched my issue.`,
2528
required: true,
2629
},
2730
],
@@ -75,8 +78,7 @@ export function createDotGitHubIssueTemplate() {
7578
required: true,
7679
},
7780
{
78-
label:
79-
"I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.",
81+
label: `I have [searched for related issues](https://github.com/${owner}/${repository}/issues?q=is%3Aissue) and found none that matched my issue.`,
8082
required: true,
8183
},
8284
],
@@ -124,8 +126,7 @@ export function createDotGitHubIssueTemplate() {
124126
required: true,
125127
},
126128
{
127-
label:
128-
"I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.",
129+
label: `I have [searched for related issues](https://github.com/${owner}/${repository}/issues?q=is%3Aissue) and found none that matched my issue.`,
129130
required: true,
130131
},
131132
],
@@ -174,8 +175,7 @@ export function createDotGitHubIssueTemplate() {
174175
required: true,
175176
},
176177
{
177-
label:
178-
"I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.",
178+
label: `I have [searched for related issues](https://github.com/${owner}/${repository}/issues?q=is%3Aissue) and found none that matched my issue.`,
179179
required: true,
180180
},
181181
],

src/hydrate/creation/dotGitHub/workflows.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
/* spellchecker: disable */
2+
import { RepositorySettings } from "../../repositorySettings.js";
23
import { createWorkflowFile } from "./createWorkflowFile.js";
34

4-
export function createWorkflows() {
5+
export function createWorkflows({
6+
owner,
7+
repository,
8+
}: Pick<RepositorySettings, "owner" | "repository">) {
59
return {
610
"build.yml": createWorkflowFile({
711
name: "Build",
@@ -46,7 +50,7 @@ export function createWorkflows() {
4650
{ uses: "./.github/actions/prepare" },
4751
{
4852
env: { GITHUB_TOKEN: "${{ secrets.ACCESS_TOKEN }}" },
49-
uses: "JoshuaKGoldberg/[email protected]",
53+
uses: `${owner}/[email protected]`,
5054
},
5155
],
5256
}),
@@ -92,8 +96,8 @@ export function createWorkflows() {
9296
9397
The release is available on:
9498
95-
* [GitHub releases](https://github.com/JoshuaKGoldberg/template-typescript-node-package/releases/tag/{release_tag})
96-
* [npm package (@latest dist-tag)](https://www.npmjs.com/package/template-typescript-node-package/v/\${{ env.npm_version }})
99+
* [GitHub releases](https://github.com/${owner}/${repository}/releases/tag/{release_tag})
100+
* [npm package (@latest dist-tag)](https://www.npmjs.com/package/${repository}/v/\${{ env.npm_version }})
97101
98102
Cheers! 📦🚀
99103
`,
@@ -152,7 +156,7 @@ export function createWorkflows() {
152156
script: `
153157
try {
154158
await github.request(
155-
\`DELETE /repos/JoshuaKGoldberg/template-typescript-node-package/branches/main/protection\`,
159+
\`DELETE /repos/${owner}/${repository}/branches/main/protection\`,
156160
);
157161
} catch (error) {
158162
if (!error.message?.includes?.("Branch not protected")) {
@@ -179,7 +183,7 @@ export function createWorkflows() {
179183
"github-token": "${{ secrets.ACCESS_TOKEN }}",
180184
script: `
181185
github.request(
182-
\`PUT /repos/JoshuaKGoldberg/template-typescript-node-package/branches/main/protection\`,
186+
\`PUT /repos/${owner}/${repository}/branches/main/protection\`,
183187
{
184188
allow_deletions: false,
185189
allow_force_pushes: true,
@@ -188,8 +192,8 @@ export function createWorkflows() {
188192
block_creations: false,
189193
branch: "main",
190194
enforce_admins: false,
191-
owner: "JoshuaKGoldberg",
192-
repo: "template-typescript-node-package",
195+
owner: "${owner}",
196+
repo: "${repository}",
193197
required_conversation_resolution: true,
194198
required_linear_history: false,
195199
required_pull_request_reviews: null,

src/hydrate/creation/rootFiles.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,13 @@ export function createRootFiles({
2626
'<img alt="All Contributors: <%= contributors.length %>" src="https://img.shields.io/badge/all_contributors-<%= contributors.length %>-21bb42.svg" />',
2727
commit: false,
2828
commitConvention: "angular",
29-
contributors: [
30-
{
31-
avatar_url: "https://avatars.githubusercontent.com/u/3335181?v=4",
32-
contributions: ["tool"],
33-
login: "JoshuaKGoldberg",
34-
name: "Josh Goldberg",
35-
profile: "http://www.joshuakgoldberg.com",
36-
},
37-
],
29+
contributors: [],
3830
contributorsPerLine: 7,
3931
contributorsSortAlphabetically: true,
4032
files: ["README.md"],
4133
imageSize: 100,
42-
projectName: "template-typescript-node-package",
43-
projectOwner: "JoshuaKGoldberg",
34+
projectName: repository,
35+
projectOwner: owner,
4436
repoHost: "https://github.com",
4537
repoType: "github",
4638
}),

0 commit comments

Comments
 (0)