summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2026-06-02 10:46:13 +0200
committerHiFiPhile <[email protected]>2026-06-02 11:03:50 +0200
commit64af21f930db48f4dfbe8c0d4c4cb0fabf839ca6 (patch)
tree240648aeeb3db80d6959593a9aeeb627acc9165d /.github/workflows
parente35b070dae92fd2750b8116a6ca0f1de393c7a6a (diff)
parent5004a24b2cceffbe998a5238f625da97537f5de7 (diff)
Merge remote-tracking branch 'tinyusb/master' into ch32_warning
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml9
-rw-r--r--.github/workflows/claude-code-review.yml26
-rw-r--r--.github/workflows/claude.yml47
3 files changed, 60 insertions, 22 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a88b8ffba..af0191149 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,7 +9,7 @@ on:
types: [ published ]
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
+ group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
@@ -326,13 +326,15 @@ jobs:
github.repository_owner == 'hathach' &&
!(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true)
runs-on: [ self-hosted, Linux, X64, hifiphile ]
+ timeout-minutes: 30
env:
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
+ PYTHONUNBUFFERED: '1'
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
- rm -rf "${{ github.workspace }}"3
+ rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- name: Toolchain version
@@ -356,4 +358,5 @@ jobs:
run: python3 tools/build.py --toolchain iar $BUILD_ARGS
- name: Test on actual hardware (hardware in the loop)
- run: python3 test/hil/hil_test.py hfp.json
+ run: |
+ python3 test/hil/hil_test.py hfp.json
diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml
index 43144bb5e..4a0e4639b 100644
--- a/.github/workflows/claude-code-review.yml
+++ b/.github/workflows/claude-code-review.yml
@@ -1,18 +1,29 @@
name: Claude Code Review
on:
- pull_request_target:
- types: [opened, synchronize, ready_for_review, reopened]
+ pull_request:
+ # opened/reopened/ready_for_review -> first auto review
+ # synchronize -> auto re-review on new pushes
+ #
+ # NOTE: pull_request (not _target) means fork PRs get a read-only GITHUB_TOKEN
+ # and NO repository secrets (CLAUDE_CODE_OAUTH_TOKEN), so they cannot be
+ # auto-reviewed. The job condition below skips them cleanly -> use @claude on
+ # those. Same-repo branches (yours or write-access contributors) auto-review.
+ types: [opened, synchronize, reopened, ready_for_review]
jobs:
claude-review:
- if: false
+ # Skip drafts, and skip fork PRs (no secrets -> would only fail noisily)
+ if: >
+ github.event.pull_request.draft == false &&
+ github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
- issues: read
+ issues: write # use_sticky_comment posts/updates a PR comment via the issues API
id-token: write
+ actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
@@ -25,8 +36,13 @@ jobs:
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+ # Pairs with the actions: read permission so Claude can read CI results
+ additional_permissions: |
+ actions: read
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
+ # Reuse one comment instead of posting a new one each push
+ use_sticky_comment: true
+ claude_args: '--max-turns 20'
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
- # or https://code.claude.com/docs/en/cli-reference for available options
diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml
index 50f449949..66e36897c 100644
--- a/.github/workflows/claude.yml
+++ b/.github/workflows/claude.yml
@@ -6,22 +6,32 @@ on:
pull_request_review_comment:
types: [created]
issues:
- types: [opened, assigned]
+ # only "opened" — an issue's author_association gates the summon below;
+ # "assigned" would gate on the issue author, not the assigner, so a
+ # maintainer assigning an outsider's issue would be wrongly skipped.
+ types: [opened]
pull_request_review:
types: [submitted]
jobs:
claude:
+ # Only trusted actors (repo owner/member/collaborator) may summon @claude, so the
+ # write-scoped token and OAuth secret are never issued for an outside contributor's
+ # comment on this public repo. Defense-in-depth on top of the action's own check.
if: |
- (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
- (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
- (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
- (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)) ||
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association))
runs-on: ubuntu-latest
permissions:
- contents: read
- pull-requests: read
- issues: read
+ contents: write # allow Claude to push commits/branches when asked
+ pull-requests: write # allow Claude to comment on / update PRs
+ issues: write # allow Claude to comment on / update issues
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
@@ -40,10 +50,19 @@ jobs:
additional_permissions: |
actions: read
- # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
- # prompt: 'Update the pull request description to include a summary of changes.'
+ # Sign the bot's commits so they show as "Verified". The action commits
+ # automatically — on a PR comment it pushes to that PR's branch; on an
+ # issue comment it opens a new claude/* branch + PR with the fix.
+ use_commit_signing: true
- # Optional: Add claude_args to customize behavior and configuration
- # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
- # or https://code.claude.com/docs/en/cli-reference for available options
- # claude_args: '--allowed-tools Bash(gh pr:*)'
+ # No custom prompt: Claude performs the instructions in the @claude comment.
+
+ # Deliberately NO Bash in the tool allowlist. @claude can be summoned on a
+ # fork PR (claude-code-review.yml even directs fork PRs here), and this job
+ # holds the OAuth secret + a write token. Any build/interpreter command
+ # (python -c, cmake/make custom targets, etc.) run against attacker-
+ # controlled PR content is arbitrary code + network execution, so no
+ # command allowlist can safely contain it. Claude still edits files and
+ # the action commits/opens the PR; the resulting commit is verified by the
+ # repo's CircleCI matrix. --max-turns gives room to investigate + fix.
+ claude_args: '--max-turns 30'