Skip to content

Commit 5563ec3

Browse files
Mossakaclaude
andauthored
fix: add auth and error handling to build-test workflows (#514)
- Add env.GH_TOKEN using GH_AW_GITHUB_MCP_SERVER_TOKEN secret - Change git clone to gh repo clone (uses GH_TOKEN automatically) - Add explicit failure handling instructions in prompts - Workflows fail visibly when clone/build/test fails Affected workflows: build-test-{java,rust,node,go,cpp,deno,bun} Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 95a3de3 commit 5563ec3

14 files changed

Lines changed: 126 additions & 14 deletions

.github/workflows/build-test-bun.lock.yml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/build-test-bun.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ safe-outputs:
3333
run-failure: "**Build Test Failed** [{workflow_name}]({run_url}) - See logs for details"
3434
timeout-minutes: 15
3535
strict: true
36+
env:
37+
GH_TOKEN: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}"
3638
---
3739

3840
# Build Test: Bun
@@ -48,7 +50,8 @@ strict: true
4850
export PATH="$BUN_INSTALL/bin:$PATH"
4951
```
5052

51-
2. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-bun.git /tmp/test-bun`
53+
2. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-bun /tmp/test-bun`
54+
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
5255

5356
3. **Test Projects**:
5457
- `elysia`: `cd /tmp/test-bun/elysia && bun install && bun test`
@@ -72,3 +75,13 @@ Add a comment to the current pull request with a summary table:
7275

7376
If ALL tests pass, add the label `build-test-bun` to the pull request.
7477
If ANY test fails, report the failure with error details.
78+
79+
## Error Handling
80+
81+
**CRITICAL**: This workflow MUST fail visibly when errors occur:
82+
83+
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
84+
2. **Bun install failure**: Call `safeoutputs-missing_tool` with "BUN_INSTALL_FAILED: [error message]"
85+
3. **Test failure**: Report in comment table with FAIL status and include failure details
86+
87+
DO NOT report success if any step fails. The workflow should produce a clear, actionable error message.

.github/workflows/build-test-cpp.lock.yml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/build-test-cpp.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ safe-outputs:
3131
run-failure: "**Build Test Failed** [{workflow_name}]({run_url}) - See logs for details"
3232
timeout-minutes: 30
3333
strict: true
34+
env:
35+
GH_TOKEN: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}"
3436
---
3537

3638
# Build Test: C++
@@ -41,7 +43,8 @@ strict: true
4143

4244
Clone and test the following projects from the test repository:
4345

44-
1. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-cpp.git /tmp/test-cpp`
46+
1. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-cpp /tmp/test-cpp`
47+
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
4548

4649
2. **Test Projects**:
4750
- `fmt`:
@@ -77,3 +80,13 @@ Add a comment to the current pull request with a summary table:
7780

7881
If ALL builds pass, add the label `build-test-cpp` to the pull request.
7982
If ANY build fails, report the failure with error details.
83+
84+
## Error Handling
85+
86+
**CRITICAL**: This workflow MUST fail visibly when errors occur:
87+
88+
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
89+
2. **CMake failure**: Report in comment table with ❌ and include error output
90+
3. **Build failure**: Report in comment table with ❌ and include failure details
91+
92+
DO NOT report success if any step fails. The workflow should produce a clear, actionable error message.

.github/workflows/build-test-deno.lock.yml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/build-test-deno.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ safe-outputs:
3535
run-failure: "**Build Test Failed** [{workflow_name}]({run_url}) - See logs for details"
3636
timeout-minutes: 15
3737
strict: true
38+
env:
39+
GH_TOKEN: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}"
3840
---
3941

4042
# Build Test: Deno
@@ -50,7 +52,8 @@ strict: true
5052
export PATH="$DENO_INSTALL/bin:$PATH"
5153
```
5254

53-
2. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-deno.git /tmp/test-deno`
55+
2. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-deno /tmp/test-deno`
56+
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
5457

5558
3. **Test Projects**:
5659
- `oak`: `cd /tmp/test-deno/oak && deno test`
@@ -73,3 +76,13 @@ Add a comment to the current pull request with a summary table:
7376

7477
If ALL tests pass, add the label `build-test-deno` to the pull request.
7578
If ANY test fails, report the failure with error details.
79+
80+
## Error Handling
81+
82+
**CRITICAL**: This workflow MUST fail visibly when errors occur:
83+
84+
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
85+
2. **Deno install failure**: Call `safeoutputs-missing_tool` with "DENO_INSTALL_FAILED: [error message]"
86+
3. **Test failure**: Report in comment table with FAIL status and include failure details
87+
88+
DO NOT report success if any step fails. The workflow should produce a clear, actionable error message.

.github/workflows/build-test-go.lock.yml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/build-test-go.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ safe-outputs:
3535
run-failure: "**Build Test Failed** [{workflow_name}]({run_url}) - See logs for details"
3636
timeout-minutes: 15
3737
strict: true
38+
env:
39+
GH_TOKEN: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}"
3840
---
3941

4042
# Build Test: Go
@@ -45,7 +47,8 @@ strict: true
4547

4648
Clone and test the following projects from the test repository:
4749

48-
1. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-go.git /tmp/test-go`
50+
1. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-go /tmp/test-go`
51+
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
4952

5053
2. **Test Projects**:
5154
- `color`: `cd /tmp/test-go/color && go mod download && go test ./...`
@@ -71,3 +74,13 @@ Add a comment to the current pull request with a summary table:
7174

7275
If ALL tests pass, add the label `build-test-go` to the pull request.
7376
If ANY test fails, report the failure with error details.
77+
78+
## Error Handling
79+
80+
**CRITICAL**: This workflow MUST fail visibly when errors occur:
81+
82+
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
83+
2. **Download failure**: Report in comment table with ❌ and include error output
84+
3. **Test failure**: Report in comment table with FAIL status and include failure details
85+
86+
DO NOT report success if any step fails. The workflow should produce a clear, actionable error message.

.github/workflows/build-test-java.lock.yml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/build-test-java.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ safe-outputs:
3535
run-failure: "**Build Test Failed** [{workflow_name}]({run_url}) - See logs for details"
3636
timeout-minutes: 15
3737
strict: true
38+
env:
39+
GH_TOKEN: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN }}"
3840
---
3941

4042
# Build Test: Java
@@ -45,7 +47,8 @@ strict: true
4547

4648
Clone and test the following projects from the test repository:
4749

48-
1. **Clone Repository**: `git clone https://github.com/Mossaka/gh-aw-firewall-test-java.git /tmp/test-java`
50+
1. **Clone Repository**: `gh repo clone Mossaka/gh-aw-firewall-test-java /tmp/test-java`
51+
- **CRITICAL**: If clone fails, immediately call `safeoutputs-missing_tool` with message "CLONE_FAILED: Unable to clone test repository" and stop execution
4952

5053
2. **Test Projects**:
5154
- `gson`: `cd /tmp/test-java/gson && mvn compile && mvn test`
@@ -69,3 +72,13 @@ Add a comment to the current pull request with a summary table:
6972

7073
If ALL tests pass, add the label `build-test-java` to the pull request.
7174
If ANY test fails, report the failure with error details.
75+
76+
## Error Handling
77+
78+
**CRITICAL**: This workflow MUST fail visibly when errors occur:
79+
80+
1. **Clone failure**: If repository clone fails, call `safeoutputs-missing_tool` with "CLONE_FAILED: [error message]"
81+
2. **Build failure**: Report in comment table with ❌ and include error output
82+
3. **Test failure**: Report in comment table with FAIL status and include failure details
83+
84+
DO NOT report success if any step fails. The workflow should produce a clear, actionable error message.

0 commit comments

Comments
 (0)