From b4c4ff63fa3271d3b2f83ac2698098ea2e1dd688 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch <103483059+DerTimonius@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:44:38 +0200 Subject: [PATCH 01/10] a11y: add alt bot --- .github/workflows/a11y-add-alt-bot.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/a11y-add-alt-bot.yml diff --git a/.github/workflows/a11y-add-alt-bot.yml b/.github/workflows/a11y-add-alt-bot.yml new file mode 100644 index 000000000..dd1f52896 --- /dev/null +++ b/.github/workflows/a11y-add-alt-bot.yml @@ -0,0 +1,26 @@ +name: Accessibility-alt-text-bot +on: + issues: + types: [opened, edited] + pull_request: + types: [opened, edited] + issue_comment: + types: [created, edited] + discussion: + types: [created, edited] + discussion_comment: + types: [created, edited] + +permissions: + issues: write + pull-requests: write + discussions: write + +jobs: + accessibility_alt_text_bot: + name: Check alt text is set on issue or pull requests + runs-on: ubuntu-latest + if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} + steps: + - name: Get action 'github/accessibility-alt-text-bot' + uses: github/accessibility-alt-text-bot@v1.4.0 \ No newline at end of file From 7aad47cadae1e5747a692a4df0a5a1bb40199429 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Fri, 27 Oct 2023 12:05:57 +0200 Subject: [PATCH 02/10] fix linting errors --- .github/workflows/a11y-add-alt-bot.yml | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/a11y-add-alt-bot.yml b/.github/workflows/a11y-add-alt-bot.yml index dd1f52896..129a074c7 100644 --- a/.github/workflows/a11y-add-alt-bot.yml +++ b/.github/workflows/a11y-add-alt-bot.yml @@ -1,26 +1,26 @@ +jobs: + accessibility_alt_text_bot: + if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} + name: Check alt text is set on issue or pull requests + runs-on: ubuntu-latest + steps: + - name: Get action 'github/accessibility-alt-text-bot' + uses: github/accessibility-alt-text-bot@v1.4.0 name: Accessibility-alt-text-bot -on: - issues: - types: [opened, edited] - pull_request: - types: [opened, edited] - issue_comment: - types: [created, edited] + +on: discussion: types: [created, edited] discussion_comment: types: [created, edited] + issue_comment: + types: [created, edited] + issues: + types: [edited, opened] + pull_request: + types: [edited, opened] permissions: + discussions: write issues: write pull-requests: write - discussions: write - -jobs: - accessibility_alt_text_bot: - name: Check alt text is set on issue or pull requests - runs-on: ubuntu-latest - if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} - steps: - - name: Get action 'github/accessibility-alt-text-bot' - uses: github/accessibility-alt-text-bot@v1.4.0 \ No newline at end of file From 453104de7d76bb3f246250e28e260c21c89b5198 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sat, 28 Oct 2023 09:59:38 +0200 Subject: [PATCH 03/10] fix failing migration test --- src/steps/writing/creation/dotGitHub/actions.test.ts | 2 +- src/steps/writing/creation/dotGitHub/actions.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/steps/writing/creation/dotGitHub/actions.test.ts b/src/steps/writing/creation/dotGitHub/actions.test.ts index 5650f7c47..e7125faec 100644 --- a/src/steps/writing/creation/dotGitHub/actions.test.ts +++ b/src/steps/writing/creation/dotGitHub/actions.test.ts @@ -15,7 +15,7 @@ name: Prepare runs: steps: - uses: pnpm/action-setup@v2 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: cache: pnpm node-version: '18' diff --git a/src/steps/writing/creation/dotGitHub/actions.ts b/src/steps/writing/creation/dotGitHub/actions.ts index 67db8be36..23f5425a5 100644 --- a/src/steps/writing/creation/dotGitHub/actions.ts +++ b/src/steps/writing/creation/dotGitHub/actions.ts @@ -11,7 +11,7 @@ export function createDotGitHubActions() { steps: [ { uses: "pnpm/action-setup@v2" }, { - uses: "actions/setup-node@v3", + uses: "actions/setup-node@v4", with: { cache: "pnpm", "node-version": "18" }, }, { From df3a57c93caa70fca92779a86efdec8c85f7d59e Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sat, 28 Oct 2023 10:18:39 +0200 Subject: [PATCH 04/10] fix migration test error --- src/steps/writing/creation/rootFiles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/steps/writing/creation/rootFiles.ts b/src/steps/writing/creation/rootFiles.ts index 595a210d1..f395393f2 100644 --- a/src/steps/writing/creation/rootFiles.ts +++ b/src/steps/writing/creation/rootFiles.ts @@ -46,7 +46,7 @@ export async function createRootFiles(options: Options) { }, }), }), - ".nvmrc": `20.8.1\n`, + ".nvmrc": `20.9.0\n`, ".prettierignore": formatIgnoreFile([ ...(options.excludeAllContributors ? [] : [".all-contributorsrc"]), ...(options.excludeTests ? [] : ["coverage/"]), From 74f8b9054d83790b116d33744e38d38c134aa11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Sat, 28 Oct 2023 13:30:44 +0200 Subject: [PATCH 05/10] Apply suggestions from code review --- .github/workflows/a11y-add-alt-bot.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/a11y-add-alt-bot.yml b/.github/workflows/a11y-add-alt-bot.yml index 129a074c7..7c55bf219 100644 --- a/.github/workflows/a11y-add-alt-bot.yml +++ b/.github/workflows/a11y-add-alt-bot.yml @@ -1,19 +1,12 @@ jobs: accessibility_alt_text_bot: if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} - name: Check alt text is set on issue or pull requests runs-on: ubuntu-latest steps: - - name: Get action 'github/accessibility-alt-text-bot' - uses: github/accessibility-alt-text-bot@v1.4.0 + - uses: github/accessibility-alt-text-bot@v1.4.0 name: Accessibility-alt-text-bot on: - discussion: - types: [created, edited] - discussion_comment: - types: [created, edited] - issue_comment: types: [created, edited] issues: @@ -21,6 +14,5 @@ on: pull_request: types: [edited, opened] permissions: - discussions: write issues: write pull-requests: write From 81e3a9b4fa7c931b1d66100316b90a65a43ae0dc Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 28 Oct 2023 13:32:13 +0200 Subject: [PATCH 06/10] remove discussions vestige --- ...{a11y-add-alt-bot.yml => accessibility-alt-text-bot.yml} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename .github/workflows/{a11y-add-alt-bot.yml => accessibility-alt-text-bot.yml} (71%) diff --git a/.github/workflows/a11y-add-alt-bot.yml b/.github/workflows/accessibility-alt-text-bot.yml similarity index 71% rename from .github/workflows/a11y-add-alt-bot.yml rename to .github/workflows/accessibility-alt-text-bot.yml index 7c55bf219..df98f5bf5 100644 --- a/.github/workflows/a11y-add-alt-bot.yml +++ b/.github/workflows/accessibility-alt-text-bot.yml @@ -1,10 +1,11 @@ jobs: accessibility_alt_text_bot: - if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} + if: ${{ github.event.issue || github.event.pull_request }} runs-on: ubuntu-latest steps: - uses: github/accessibility-alt-text-bot@v1.4.0 -name: Accessibility-alt-text-bot + +name: Accessibility Alt Text Bot on: issue_comment: @@ -13,6 +14,7 @@ on: types: [edited, opened] pull_request: types: [edited, opened] + permissions: issues: write pull-requests: write From 727e94978f4e865ded17f935131abbd4d4f1a865 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sat, 28 Oct 2023 20:18:19 +0200 Subject: [PATCH 07/10] Add bot to created files, update test --- .../creation/dotGitHub/createWorkflowFile.ts | 7 +++ .../dotGitHub/createWorkflows.test.ts | 58 ++++++++++++++++++- .../creation/dotGitHub/createWorkflows.ts | 28 ++++++++- 3 files changed, 89 insertions(+), 4 deletions(-) diff --git a/src/steps/writing/creation/dotGitHub/createWorkflowFile.ts b/src/steps/writing/creation/dotGitHub/createWorkflowFile.ts index da7417d09..289d6bf8b 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflowFile.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflowFile.ts @@ -6,6 +6,12 @@ interface WorkflowFileConcurrency { } interface WorkflowFileOn { + issue?: { + types?: string[]; + }; + issue_comment?: { + types?: string[]; + }; pull_request?: | { branches?: string | string[]; @@ -28,6 +34,7 @@ interface WorkflowFileOn { interface WorkflowFilePermissions { contents?: string; "id-token"?: string; + issues?: string; "pull-requests"?: string; } diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts index 484c1bd44..84193241f 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflows.test.ts @@ -41,6 +41,33 @@ describe("createWorkflows", () => { expect(workflows).toMatchInlineSnapshot(` { + "accessibility-alt-text-bot.yml": "jobs: + accessibility_alt_text_bot: + runs-on: ubuntu-latest + steps: + - if: \${{ github.event.issue || github.event.pull_request }} + uses: github/accessibility-alt-text-bot@v1.4.0 + + name: Accessibility Alt Text Bot + + on: + issue: + types: + - created + - edited + issue_comment: + types: + - created + - edited + pull_request: + types: + - created + - edited + + permissions: + issues: write + pull-requests: write + ", "build.yml": "jobs: build: runs-on: ubuntu-latest @@ -218,10 +245,10 @@ describe("createWorkflows", () => { :tada: This is included in version {release_link} :tada: The release is available on: - + * [GitHub releases](https://github.com/StubOwner/stub-repository/releases/tag/{release_tag}) * [npm package (@latest dist-tag)](https://www.npmjs.com/package/stub-repository/v/\${{ env.npm_version }}) - + Cheers! 📦🚀 name: Post Release @@ -341,6 +368,33 @@ describe("createWorkflows", () => { expect(workflows).toMatchInlineSnapshot(` { + "accessibility-alt-text-bot.yml": "jobs: + accessibility_alt_text_bot: + runs-on: ubuntu-latest + steps: + - if: \${{ github.event.issue || github.event.pull_request }} + uses: github/accessibility-alt-text-bot@v1.4.0 + + name: Accessibility Alt Text Bot + + on: + issue: + types: + - created + - edited + issue_comment: + types: + - created + - edited + pull_request: + types: + - created + - edited + + permissions: + issues: write + pull-requests: write + ", "build.yml": "jobs: build: runs-on: ubuntu-latest diff --git a/src/steps/writing/creation/dotGitHub/createWorkflows.ts b/src/steps/writing/creation/dotGitHub/createWorkflows.ts index 901cf4cf0..13b386aeb 100644 --- a/src/steps/writing/creation/dotGitHub/createWorkflows.ts +++ b/src/steps/writing/creation/dotGitHub/createWorkflows.ts @@ -89,6 +89,30 @@ export function createWorkflows(options: Options) { ], }), }), + "accessibility-alt-text-bot.yml": createWorkflowFile({ + name: "Accessibility Alt Text Bot", + on: { + issue: { + types: ["created", "edited"], + }, + issue_comment: { + types: ["created", "edited"], + }, + pull_request: { + types: ["created", "edited"], + }, + }, + permissions: { + issues: "write", + "pull-requests": "write", + }, + steps: [ + { + if: "${{ github.event.issue || github.event.pull_request }}", + uses: "github/accessibility-alt-text-bot@v1.4.0", + }, + ], + }), "lint.yml": createWorkflowFile({ name: "Lint", runs: ["pnpm build || true", "pnpm lint"], @@ -144,10 +168,10 @@ export function createWorkflows(options: Options) { :tada: This is included in version {release_link} :tada: The release is available on: - + * [GitHub releases](https://github.com/${options.owner}/${options.repository}/releases/tag/{release_tag}) * [npm package (@latest dist-tag)](https://www.npmjs.com/package/${options.repository}/v/\${{ env.npm_version }}) - + Cheers! 📦🚀 `, }, From 37707177d6bd0be16c606dd31483b039b81a5617 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sat, 28 Oct 2023 20:23:11 +0200 Subject: [PATCH 08/10] update migrate-test script --- script/migrate-test-e2e.js | 1 + 1 file changed, 1 insertion(+) diff --git a/script/migrate-test-e2e.js b/script/migrate-test-e2e.js index 24afec867..d926ae4b7 100644 --- a/script/migrate-test-e2e.js +++ b/script/migrate-test-e2e.js @@ -37,6 +37,7 @@ const filesExpectedToBeChanged = new Set([ ".github/DEVELOPMENT.md", ".github/workflows/lint-knip.yml", ".github/workflows/test.yml", + ".github/workflows/accessibility-alt-text-bot.yml", ".gitignore", ".prettierignore", "cspell.json", From bdd6683732e0e14ba952b859301c1074e28e6e56 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sun, 29 Oct 2023 07:54:45 +0100 Subject: [PATCH 09/10] Implement requested change --- .github/workflows/accessibility-alt-text-bot.yml | 14 ++++++++++---- script/migrate-test-e2e.js | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/accessibility-alt-text-bot.yml b/.github/workflows/accessibility-alt-text-bot.yml index df98f5bf5..0970ed17f 100644 --- a/.github/workflows/accessibility-alt-text-bot.yml +++ b/.github/workflows/accessibility-alt-text-bot.yml @@ -8,12 +8,18 @@ jobs: name: Accessibility Alt Text Bot on: + issue: + types: + - created + - edited issue_comment: - types: [created, edited] - issues: - types: [edited, opened] + types: + - created + - edited pull_request: - types: [edited, opened] + types: + - created + - edited permissions: issues: write diff --git a/script/migrate-test-e2e.js b/script/migrate-test-e2e.js index d926ae4b7..24afec867 100644 --- a/script/migrate-test-e2e.js +++ b/script/migrate-test-e2e.js @@ -37,7 +37,6 @@ const filesExpectedToBeChanged = new Set([ ".github/DEVELOPMENT.md", ".github/workflows/lint-knip.yml", ".github/workflows/test.yml", - ".github/workflows/accessibility-alt-text-bot.yml", ".gitignore", ".prettierignore", "cspell.json", From 50fe1de2b37498b3e9613c24fbc245c353de2b79 Mon Sep 17 00:00:00 2001 From: Timon Jurschitsch Date: Sun, 29 Oct 2023 07:58:52 +0100 Subject: [PATCH 10/10] adopt last change from template --- .github/workflows/accessibility-alt-text-bot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/accessibility-alt-text-bot.yml b/.github/workflows/accessibility-alt-text-bot.yml index 0970ed17f..dd6ca9b34 100644 --- a/.github/workflows/accessibility-alt-text-bot.yml +++ b/.github/workflows/accessibility-alt-text-bot.yml @@ -1,9 +1,9 @@ jobs: accessibility_alt_text_bot: - if: ${{ github.event.issue || github.event.pull_request }} runs-on: ubuntu-latest steps: - - uses: github/accessibility-alt-text-bot@v1.4.0 + - if: ${{ github.event.issue || github.event.pull_request }} + uses: github/accessibility-alt-text-bot@v1.4.0 name: Accessibility Alt Text Bot