Skip to content

Commit

Permalink
feat: always run build || exit 0 before lint in CI (#936)
Browse files Browse the repository at this point in the history
## PR Checklist

- [x] Addresses an existing open issue: fixes #935
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

Adds `pnpm build || true` before `pnpm lint` in the templated
`lint.yml`. That's what this repo already does, so this essentially
makes templated repos more like this one.
  • Loading branch information
JoshuaKGoldberg committed Oct 2, 2023
1 parent 67a61bb commit 827b4b4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ For example, ESLint can be run with `--fix` to auto-fix some lint rule complaint
pnpm run lint --fix
```

Note that you'll likely need to run `pnpm build` before `pnpm lint` so that lint rules which check the file system can pick up on any built files.

## Testing

[Vitest](https://vitest.dev) is used for tests.
Expand Down
1 change: 0 additions & 1 deletion script/migrate-test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const filesExpectedToBeChanged = new Set([
".eslintignore",
".eslintrc.cjs",
".github/DEVELOPMENT.md",
".github/workflows/lint.yml",
".github/workflows/lint-knip.yml",
".github/workflows/test.yml",
".gitignore",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ describe("createDevelopment", () => {
pnpm run lint --fix
\`\`\`
Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files.
## Testing
[Vitest](https://vitest.dev) is used for tests.
Expand Down Expand Up @@ -215,6 +217,8 @@ describe("createDevelopment", () => {
pnpm run lint --fix
\`\`\`
Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files.
## Testing
[Vitest](https://vitest.dev) is used for tests.
Expand Down
2 changes: 2 additions & 0 deletions src/steps/writing/creation/dotGitHub/createDevelopment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:`
pnpm run lint --fix
\`\`\`
Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files.
${
!options.excludeTests &&
`## Testing
Expand Down
2 changes: 2 additions & 0 deletions src/steps/writing/creation/dotGitHub/createWorkflows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ describe("createWorkflows", () => {
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build || true
- run: pnpm lint
name: Lint
Expand Down Expand Up @@ -363,6 +364,7 @@ describe("createWorkflows", () => {
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build || true
- run: pnpm lint
name: Lint
Expand Down
2 changes: 1 addition & 1 deletion src/steps/writing/creation/dotGitHub/createWorkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function createWorkflows(options: Options) {
}),
"lint.yml": createWorkflowFile({
name: "Lint",
runs: ["pnpm lint"],
runs: ["pnpm build || true", "pnpm lint"],
}),
...(!options.excludeLintKnip && {
"lint-knip.yml": createWorkflowFile({
Expand Down

0 comments on commit 827b4b4

Please sign in to comment.