Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/opencode-audit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: opencode-audit

# Required repository secrets:
# - OPENCODE_PAT: Classic PAT with `repo` scope OR fine-grained PAT with:
# Contents: Read, Issues: Read & Write, Pull requests: Read & Write
# Without proper scopes, gh issue create and label operations will fail.
# - MINIMAX_API_KEY: API key for the MiniMax M2.7 model

on:
schedule:
- cron: '0 6 * * *'
Expand Down Expand Up @@ -65,7 +71,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ github.token }}
token: ${{ secrets.OPENCODE_PAT }}

- name: Configure git identity
run: |
git config user.name "opencode[bot]"
git config user.email "opencode[bot]@users.noreply.github.com"

- name: Setup Nix
uses: ./.github/actions/setup-nix
Expand All @@ -78,7 +89,21 @@ jobs:
--color "1D76DB" || true
fi
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.OPENCODE_PAT }}

- name: Validate module directory exists
run: |
MODULE_PATH="${{ steps.select-module.outputs.module_path }}"
if [ ! -d "$MODULE_PATH" ]; then
echo "::warning::Module directory '$MODULE_PATH' does not exist — audit may be limited to partial or no source files"
echo "Listing parent directory:"
PARENT=$(dirname "$MODULE_PATH")
ls -la "$PARENT" 2>/dev/null || echo "Parent directory '$PARENT' also missing"
else
echo "Module directory confirmed: $MODULE_PATH"
echo "Files in module:"
find "$MODULE_PATH" -name '*.zig' | head -20
fi

- name: Ensure opencode cache dir exists
run: |
Expand Down Expand Up @@ -323,4 +348,4 @@ jobs:
echo "✅ No compliance violations detected."
fi
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.OPENCODE_PAT }}
23 changes: 23 additions & 0 deletions .github/workflows/opencode-test-writer.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: opencode-test-writer

# Required repository secrets:
# - OPENCODE_PAT: Classic PAT with `repo` scope OR fine-grained PAT with:
# Contents: Read & Write, Pull requests: Read & Write, Metadata: Read
# Without `repo` scope, git push will fail with 403 permission denied.
# - MINIMAX_API_KEY: API key for the MiniMax M2.7 model

on:
schedule:
- cron: '0 4 * * *'
Expand All @@ -26,7 +32,7 @@
id: select-module
env:
INPUT_MODULE: ${{ inputs.module }}
run: |

Check failure on line 35 in .github/workflows/opencode-test-writer.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2129:style:49:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck] Raw Output: e:.github/workflows/opencode-test-writer.yml:35:9: shellcheck reported issue in this script: SC2129:style:49:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]
GRAPHICS_MODULES=(
"graphics/vulkan-device"
"graphics/vulkan-resources"
Expand Down Expand Up @@ -133,13 +139,21 @@
;;
esac

# OPENCODE_PAT must be a classic PAT with `repo` scope (full control of private repositories)
# or a fine-grained PAT with Contents: Read & Write on this repository.
# Without write permission, git push will fail with 403.
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ steps.select-module.outputs.base_branch }}
fetch-depth: 0
token: ${{ secrets.OPENCODE_PAT }}

- name: Configure git identity
run: |
git config user.name "opencode[bot]"
git config user.email "opencode[bot]@users.noreply.github.com"

- name: Ensure test label exists
run: |
if ! gh label list --json name --jq '.[].name' | grep -q '^automated-test$'; then
Expand Down Expand Up @@ -184,6 +198,15 @@
echo "::warning::$MISSING scan path(s) missing — the scan_paths case statement in this workflow may need updating"
fi

- name: Verify PAT push permissions
if: steps.check-existing.outputs.skip != 'true'
run: |
if ! git push --dry-run origin HEAD:${{ steps.select-module.outputs.base_branch }} 2>/dev/null; then
echo "::error::OPENCODE_PAT cannot push to repository. Ensure the PAT has 'repo' scope (classic) or Contents: Read & Write (fine-grained)."
exit 1
fi
echo "PAT has push permissions."

- name: Setup Nix
if: steps.check-existing.outputs.skip != 'true'
uses: ./.github/actions/setup-nix
Expand Down
Loading