diff --git a/.github/workflows/accessibility-alt-text-bot.yml b/.github/workflows/accessibility-alt-text-bot.yml new file mode 100644 index 000000000..dd6ca9b34 --- /dev/null +++ b/.github/workflows/accessibility-alt-text-bot.yml @@ -0,0 +1,26 @@ +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 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! 📦🚀 `, },