Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: normalize yaml outputs to always use -1 lineWidth #2098

Merged
merged 2 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ body:
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea

description: Report a bug trying to run the code

labels:
- "type: bug"

name: 🐛 Bug

title: "🐛 Bug: <short description of the bug>"
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/02-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ body:
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea

description: Report a typo or missing area of documentation

labels:
- "area: documentation"

name: 📝 Documentation

title: "📝 Documentation: <short description of the request>"
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/03-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ body:
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea

description: Request that a new feature be added or an existing feature improved

labels:
- "type: feature"

name: 🚀 Feature

title: "🚀 Feature: <short description of the feature>"
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/04-tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ body:
description: Any additional info you'd like to provide.
label: Additional Info
type: textarea

description: Report a bug or request an enhancement in repository tooling

labels:
- "area: tooling"

name: 🛠 Tooling

title: "🛠 Tooling: <short description of the change>"
6 changes: 6 additions & 0 deletions src/blocks/blockAllContributors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ describe("blockAllContributors", () => {
GITHUB_TOKEN: \${{ secrets.ACCESS_TOKEN }}
uses: JoshuaKGoldberg/[email protected]


name: Contributors


on:
push:
branches:
Expand Down Expand Up @@ -187,8 +189,10 @@ describe("blockAllContributors", () => {
GITHUB_TOKEN: \${{ secrets.ACCESS_TOKEN }}
uses: JoshuaKGoldberg/[email protected]


name: Contributors


on:
push:
branches:
Expand Down Expand Up @@ -305,8 +309,10 @@ describe("blockAllContributors", () => {
GITHUB_TOKEN: \${{ secrets.ACCESS_TOKEN }}
uses: JoshuaKGoldberg/[email protected]


name: Contributors


on:
push:
branches:
Expand Down
17 changes: 7 additions & 10 deletions src/blocks/blockCTATransitions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,15 @@ describe("blockCTATransitions", () => {
uses: mshick/add-pr-comment@v2
with:
issue: \${{ github.event.pull_request.number }}
message: >-
🤖 Beep boop! I ran \`npx create-typescript-app\` and it updated some
files.
message: |-
🤖 Beep boop! I ran \`npx create-typescript-app\` and it updated some files.

I went ahead and checked those changes into this PR for you. Please
review the latest commit to see if you want to merge it.
I went ahead and checked those changes into this PR for you. Please review the latest commit to see if you want to merge it.

Cheers!
— _The Friendly Bingo Bot_ 💝

> ℹ️ These automatic commits keep your repository up-to-date with new
versions of
[create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
If you want to opt out, delete your
\`.github/workflows/cta-transitions.yml\` file.
> ℹ️ These automatic commits keep your repository up-to-date with new versions of [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app). If you want to opt out, delete your \`.github/workflows/cta-transitions.yml\` file.
using: composite
",
},
Expand All @@ -87,13 +81,16 @@ describe("blockCTATransitions", () => {
- if: steps.check.outcome == 'skipped'
run: echo 'Skipping transition mode because the PR does not appear to be an automated or owner-created update to create-typescript-app.'


name: CTA


on:
pull_request:
branches:
- main


permissions:
pull-requests: write
",
Expand Down
6 changes: 4 additions & 2 deletions src/blocks/blockCTATransitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { resolveUses } from "./actions/resolveUses.js";
import { blockPackageJson } from "./blockPackageJson.js";
import { blockRepositoryBranchRuleset } from "./blockRepositoryBranchRuleset.js";
import { createSoloWorkflowFile } from "./files/createSoloWorkflowFile.js";
import { formatYamlAction } from "./files/formatYamlAction.js";
import { formatYaml } from "./files/formatYaml.js";

export const blockCTATransitions = base.createBlock({
about: {
Expand All @@ -28,7 +28,7 @@ export const blockCTATransitions = base.createBlock({
".github": {
actions: {
transition: {
"action.yml": formatYamlAction({
"action.yml": formatYaml({
description: "Runs create-typescript-app in transition mode",
name: "Transition",
runs: {
Expand Down Expand Up @@ -65,7 +65,9 @@ export const blockCTATransitions = base.createBlock({
issue: "${{ github.event.pull_request.number }}",
message: [
"🤖 Beep boop! I ran `npx create-typescript-app` and it updated some files.",
"",
"I went ahead and checked those changes into this PR for you. Please review the latest commit to see if you want to merge it.",
"",
"Cheers!",
" — _The Friendly Bingo Bot_ 💝",
"",
Expand Down
20 changes: 20 additions & 0 deletions src/blocks/blockGitHubActionsCI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ describe("blockGitHubActionsCI", () => {
steps:
- uses: github/[email protected]


name: Accessibility Alt Text Bot


on:
issue_comment:
types:
Expand All @@ -65,6 +67,7 @@ describe("blockGitHubActionsCI", () => {
- edited
- opened


permissions:
issues: write
pull-requests: write
Expand All @@ -82,13 +85,16 @@ describe("blockGitHubActionsCI", () => {
echo "Don't worry if the previous step failed."
echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221."


name: PR Review Requested


on:
pull_request_target:
types:
- review_requested


permissions:
pull-requests: write
",
Expand Down Expand Up @@ -153,8 +159,10 @@ describe("blockGitHubActionsCI", () => {
steps:
- uses: github/[email protected]


name: Accessibility Alt Text Bot


on:
issue_comment:
types:
Expand All @@ -169,6 +177,7 @@ describe("blockGitHubActionsCI", () => {
- edited
- opened


permissions:
issues: write
pull-requests: write
Expand All @@ -186,13 +195,16 @@ describe("blockGitHubActionsCI", () => {
echo "Don't worry if the previous step failed."
echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221."


name: PR Review Requested


on:
pull_request_target:
types:
- review_requested


permissions:
pull-requests: write
",
Expand Down Expand Up @@ -264,8 +276,10 @@ describe("blockGitHubActionsCI", () => {
steps:
- uses: github/[email protected]


name: Accessibility Alt Text Bot


on:
issue_comment:
types:
Expand All @@ -280,6 +294,7 @@ describe("blockGitHubActionsCI", () => {
- edited
- opened


permissions:
issues: write
pull-requests: write
Expand All @@ -298,8 +313,10 @@ describe("blockGitHubActionsCI", () => {
with:
VAR_WITH: 'true'


name: CI


on:
pull_request: ~
push:
Expand All @@ -318,13 +335,16 @@ describe("blockGitHubActionsCI", () => {
echo "Don't worry if the previous step failed."
echo "See https://github.com/actions-ecosystem/action-remove-labels/issues/221."


name: PR Review Requested


on:
pull_request_target:
types:
- review_requested


permissions:
pull-requests: write
",
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/blockGitHubActionsCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { blockRemoveFiles } from "./blockRemoveFiles.js";
import { blockRepositoryBranchRuleset } from "./blockRepositoryBranchRuleset.js";
import { createMultiWorkflowFile } from "./files/createMultiWorkflowFile.js";
import { createSoloWorkflowFile } from "./files/createSoloWorkflowFile.js";
import { formatYamlAction } from "./files/formatYamlAction.js";
import { formatYaml } from "./files/formatYaml.js";

export const zActionStep = z.intersection(
z.object({
Expand Down Expand Up @@ -46,7 +46,7 @@ export const blockGitHubActionsCI = base.createBlock({
".github": {
actions: {
prepare: {
"action.yml": formatYamlAction({
"action.yml": formatYaml({
description: "Prepares the repo for a typical CI job",
name: "Prepare",
runs: {
Expand Down
14 changes: 14 additions & 0 deletions src/blocks/blockReleaseIt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,24 @@ describe("blockReleaseIt", () => {

Cheers! 📦🚀


name: Post Release


on:
release:
types:
- published


permissions:
issues: write
pull-requests: write
",
"release.yml": "concurrency:
group: \${{ github.workflow }}


jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -117,13 +121,16 @@ describe("blockReleaseIt", () => {
NPM_TOKEN: \${{ secrets.NPM_TOKEN }}
uses: JoshuaKGoldberg/[email protected]


name: Release


on:
push:
branches:
- main


permissions:
contents: write
id-token: write
Expand Down Expand Up @@ -237,20 +244,24 @@ describe("blockReleaseIt", () => {

Cheers! 📦🚀


name: Post Release


on:
release:
types:
- published


permissions:
issues: write
pull-requests: write
",
"release.yml": "concurrency:
group: \${{ github.workflow }}


jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -269,13 +280,16 @@ describe("blockReleaseIt", () => {
NPM_TOKEN: \${{ secrets.NPM_TOKEN }}
uses: JoshuaKGoldberg/[email protected]


name: Release


on:
push:
branches:
- main


permissions:
contents: write
id-token: write
Expand Down
5 changes: 4 additions & 1 deletion src/blocks/files/formatYaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ const options: jsYaml.DumpOptions = {
};

export function formatYaml(value: unknown) {
return removeUsesQuotes(jsYaml.dump(value, options));
return removeUsesQuotes(jsYaml.dump(value, options)).replaceAll(
/\n(\S)/g,
"\n\n$1",
);
}
7 changes: 0 additions & 7 deletions src/blocks/files/formatYamlAction.ts

This file was deleted.