Skip to content

Commit 218df8f

Browse files
authored
ci: do not run accessibility checks for bots (#1319)
## PR Checklist - [x] Addresses an existing open issue: fixes #1318 - [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 See linked issue. I set this up in my repo in danvk/gravlax#58 following typescript-eslint/typescript-eslint#8212. We can wait for a few renovate bot updates on my repo to confirm that this has the desired effect. I added support for top-level `if` statements on jobs. It's possible to skip an individual step (which is already supported) but skipping the entire job seems more correct: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif
1 parent 9144884 commit 218df8f

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

Diff for: .github/workflows/accessibility-alt-text-bot.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
jobs:
22
accessibility_alt_text_bot:
3+
if: ${{ !endsWith(github.actor, '[bot]') }}
34
runs-on: ubuntu-latest
45
steps:
56
- uses: github/[email protected]

Diff for: src/steps/writing/creation/dotGitHub/createWorkflowFile.ts

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface WorkflowFileStep {
4949

5050
interface WorkflowFileOptionsBase {
5151
concurrency?: WorkflowFileConcurrency;
52+
if?: string;
5253
name: string;
5354
on?: WorkflowFileOn;
5455
permissions?: WorkflowFilePermissions;
@@ -81,6 +82,7 @@ export function createWorkflowFile({
8182
concurrency,
8283
jobs: {
8384
[name.replaceAll(" ", "_").toLowerCase()]: {
85+
...(options.if && { if: options.if }),
8486
"runs-on": "ubuntu-latest",
8587
steps:
8688
"runs" in options

Diff for: src/steps/writing/creation/dotGitHub/createWorkflows.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ describe("createWorkflows", () => {
4141
{
4242
"accessibility-alt-text-bot.yml": "jobs:
4343
accessibility_alt_text_bot:
44+
if: \${{ !endsWith(github.actor, '[bot]') }}
4445
runs-on: ubuntu-latest
4546
steps:
4647
- uses: github/[email protected]
@@ -351,6 +352,7 @@ describe("createWorkflows", () => {
351352
{
352353
"accessibility-alt-text-bot.yml": "jobs:
353354
accessibility_alt_text_bot:
355+
if: \${{ !endsWith(github.actor, '[bot]') }}
354356
runs-on: ubuntu-latest
355357
steps:
356358
- uses: github/[email protected]

Diff for: src/steps/writing/creation/dotGitHub/createWorkflows.ts

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export function createWorkflows(options: Options) {
9090
}),
9191
}),
9292
"accessibility-alt-text-bot.yml": createWorkflowFile({
93+
if: "${{ !endsWith(github.actor, '[bot]') }}",
9394
name: "Accessibility Alt Text Bot",
9495
on: {
9596
issue_comment: {

0 commit comments

Comments
 (0)