Skip to content

Commit e03ca28

Browse files
CopilotGarbee
andauthored
fix(workflows): apply workflow review guidelines across all workflows (#19)
- [x] Review all 5 workflow files against GitHub workflow review instructions - [x] Fix must-fix issues (security & reliability) - [x] Add missing timeout-minutes to all jobs (5 minutes for all jobs per repository requirements) - [x] Fix runner version pinning (ubuntu-latest → ubuntu-24.04 in codeql.yml) - [x] Fix concurrency settings (cancel-in-progress uses != 'push' for better coverage) - [x] Add missing shell safety (set -euo pipefail) to all multi-line scripts - [x] Address improvement issues (maintainability) - [x] Fix step naming to use proper title case - [x] Fix shell flags (euoC → euo in copilot-setup-steps.yml) - [x] Validate all changes - [x] All tests pass (38/38 tests passing) - [x] All workflows syntax validated - [x] Update workflow review instructions for consistency - [x] Resolve merge conflicts with main branch <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Signed-off-by: Jonathan Garbee <jonathan@garbee.me> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Garbee <868301+Garbee@users.noreply.github.com> Co-authored-by: Jonathan Garbee <jonathan@garbee.me>
1 parent 92e59d3 commit e03ca28

6 files changed

Lines changed: 38 additions & 20 deletions

File tree

.github/instructions/github-workflow-review.instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ You are an expert GitHub Actions engineer and security reviewer. Your goal is to
6060
- `github.head_ref` is only populated for pull request events, so the OR operator (`||`) falls back to `github.ref_name` for push events.
6161
- `github.ref_name` provides a succinct name (e.g., `main`) instead of the full ref path (e.g., `refs/heads/main`).
6262
- This ensures PR runs are grouped separately from target branch runs (e.g., `Workflow-feature-branch` vs `Workflow-main`).
63-
- **Cancel in Progress:** Use `cancel-in-progress: ${{ github.event_name == 'pull_request' }}` to cancel outdated PR runs while allowing push events to complete.
63+
- **Cancel in Progress:** Use `cancel-in-progress: ${{ github.event_name != 'push' }}` to cancel outdated PR runs while allowing push events to complete.
6464
- PR runs benefit from cancellation when new commits are pushed.
6565
- Push events to protected branches should complete to ensure deployment pipelines finish.
6666

@@ -230,7 +230,7 @@ permissions:
230230
231231
concurrency:
232232
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
233-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
233+
cancel-in-progress: ${{ github.event_name != 'push' }}
234234
235235
jobs:
236236
test:

.github/workflows/actionlint.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,28 @@ jobs:
1818
actionlint:
1919
name: Actionlint
2020
runs-on: ubuntu-24.04
21+
timeout-minutes: 5
2122
permissions:
2223
contents: read # Only needed for private repos. Needed to clone the repo.
2324
actions: read # Only needed for private repos. Needed for upload-sarif to read workflow run info.
2425
security-events: write # Required for upload-sarif to upload SARIF files.
2526
steps:
26-
- name: Checkout repository
27+
- name: Checkout Repository
2728
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2829
with:
2930
persist-credentials: false
3031
- name: Start Workflow Telemetry
3132
uses: ./
3233
with:
3334
github-token: ${{ secrets.GITHUB_TOKEN }}
34-
- name: Check workflow files
35+
- name: Install actionlint
36+
run: go install github.com/rhysd/actionlint/cmd/actionlint@latest
37+
- name: Add GOPATH to PATH
38+
run: echo "$HOME/go/bin" >> "$GITHUB_PATH"
39+
- name: Check Workflow Files
3540
run: actionlint -format "$(cat .github/formatters/actionlint-sarif.gotmpl)" .github/workflows/*.yml > actionlint.sarif
36-
- name: Upload SARIF file
41+
- name: Upload SARIF File
42+
if: ${{ always() }} # Ensure this runs even if the actionlint step fails, so we get results in the Security tab.
3743
uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
3844
with:
3945
sarif_file: actionlint.sarif

.github/workflows/codeql.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ on:
1010
- cron: "33 11 * * 3"
1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
13-
cancel-in-progress: true
13+
cancel-in-progress: ${{ github.event_name != 'push' }}
1414
permissions: {}
1515
jobs:
1616
analyze:
1717
name: Analyze (${{ matrix.language }})
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 5
1920
permissions:
2021
security-events: write # To upload the results of the analysis
2122
packages: read # To fetch CodeQL packs from GitHub Packages, if you are using any.
@@ -28,7 +29,7 @@ jobs:
2829
- language: actions
2930
- language: javascript-typescript
3031
steps:
31-
- name: Checkout repository
32+
- name: Checkout Repository
3233
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3334
with:
3435
persist-credentials: false

.github/workflows/copilot-setup-steps.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
concurrency:
1818
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
19-
cancel-in-progress: true
19+
cancel-in-progress: ${{ github.event_name != 'push' }}
2020

2121
permissions: {}
2222

@@ -26,6 +26,7 @@ jobs:
2626
name: Copilot Setup
2727

2828
runs-on: ubuntu-24.04
29+
timeout-minutes: 5
2930

3031
# Note: Do not try to run inside of a container yet. That causes all the setup scripts
3132
# by Copilot to fail since that triggers `sh` instead of `bash` for runs. Setting
@@ -43,21 +44,23 @@ jobs:
4344
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4445
with:
4546
persist-credentials: false
46-
- name: Setup NodeJS
47+
- name: Setup Node.js
4748
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
4849
with:
4950
node-version-file: .node-version
5051
cache: npm
5152
- name: Install Dependencies
5253
run: npm ci
53-
- name: Install actionlint
54+
- name: Install Actionlint
5455
run: go install github.com/rhysd/actionlint/cmd/actionlint@latest
56+
- name: Add GOPATH to PATH
57+
run: echo "$HOME/go/bin" >> "$GITHUB_PATH"
5558
- name: Install Zizmor
5659
env:
5760
TMP_DIR: ${{ runner.temp }}
5861
GH_TOKEN: ${{ github.token }}
5962
run: |
60-
set -euoC pipefail
63+
set -euo pipefail
6164
tarball="$TMP_DIR/zizmor.tar.gz"
6265
gh release download --repo zizmorcore/zizmor --pattern "zizmor-x86_64-unknown-linux-gnu.tar.gz" --output "$tarball"
6366
tar -xzf "$tarball" -C "$TMP_DIR"

.github/workflows/test-action.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010
workflow_dispatch:
1111

1212
concurrency:
13-
group: ${{ github.workflow }}-${{ github.head_ref }}-${{ github.ref }}
14-
cancel-in-progress: true
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
14+
cancel-in-progress: ${{ github.event_name != 'push' }}
1515

1616
permissions:
1717
contents: read # To clone the repository
@@ -21,8 +21,9 @@ jobs:
2121
test-basic:
2222
name: Test Basic Usage
2323
runs-on: ubuntu-24.04
24+
timeout-minutes: 5
2425
steps:
25-
- name: Checkout Code
26+
- name: Checkout Repository
2627
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2728
with:
2829
persist-credentials: false
@@ -46,8 +47,9 @@ jobs:
4647
test-custom-interval:
4748
name: Test Custom Interval
4849
runs-on: ubuntu-24.04
50+
timeout-minutes: 5
4951
steps:
50-
- name: Checkout Code
52+
- name: Checkout Repository
5153
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5254
with:
5355
persist-credentials: false
@@ -60,15 +62,17 @@ jobs:
6062

6163
- name: Simulate Workload
6264
run: |
65+
set -euo pipefail
6366
echo "Simulating CPU and memory intensive workload"
6467
sleep 10
6568
echo "Workload simulation complete"
6669
6770
test-resource-visualization:
6871
name: Test Resource Visualization
6972
runs-on: ubuntu-24.04
73+
timeout-minutes: 5
7074
steps:
71-
- name: Checkout Code
75+
- name: Checkout Repository
7276
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7377
with:
7478
persist-credentials: false
@@ -84,6 +88,7 @@ jobs:
8488

8589
- name: CPU and Storage Intensive Activity
8690
run: |
91+
set -euo pipefail
8792
echo "Starting CPU-intensive activity for 15 seconds..."
8893
echo "Creating 5GB test file to demonstrate disk usage..."
8994
dd if=/dev/zero of=/tmp/test-5gb-file.bin bs=1M count=5120 status=progress
@@ -109,6 +114,7 @@ jobs:
109114
110115
- name: Memory Intensive Activity
111116
run: |
117+
set -euo pipefail
112118
echo "Starting memory-intensive activity for 15 seconds..."
113119
node -e "
114120
const arrays = [];
@@ -138,6 +144,7 @@ jobs:
138144
139145
- name: Idle Activity
140146
run: |
147+
set -euo pipefail
141148
echo "Starting idle period for 5 seconds..."
142149
sleep 5
143150
echo "Idle period completed."

.github/workflows/zizmor.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
13-
cancel-in-progress: true
13+
cancel-in-progress: ${{ github.event_name != 'push' }}
1414

1515
permissions:
1616
contents: read # To clone the repository
@@ -19,20 +19,21 @@ jobs:
1919
zizmor:
2020
name: Zizmor
2121
runs-on: ubuntu-24.04
22+
timeout-minutes: 5
2223
permissions:
2324
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
2425
contents: read # Only needed for private repos. Needed to clone the repo.
2526
actions: read # Only needed for private repos. Needed for upload-sarif to read workflow run info.
2627
steps:
27-
- name: Checkout Code
28+
- name: Checkout Repository
2829
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2930
with:
3031
persist-credentials: false
3132
- name: Start Workflow Telemetry
3233
uses: ./
3334
with:
3435
github-token: ${{ secrets.GITHUB_TOKEN }}
35-
- name: Run zizmor
36+
- name: Run Zizmor
3637
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0
3738
with:
3839
persona: auditor

0 commit comments

Comments
 (0)