Repository navigation
build: mention @claude in github to get work done #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
30e2be8
Add Claude Code SessionStart hook for remote environment setup
claude dcc1cdd
Pre-download Tenderdash proto sources to fix build in sandboxed envs
claude fd03a1c
Harden Claude Code session hook and settings
claude 7c996e2
Fix CI: replace deprecated actions-rs/* and correct branch trigger
claude 0b76908
Add Claude Code GitHub Action workflow
lklimek 3c6bb1f
Fix Claude workflow: pass Anthropic token as anthropic_api_key, not g…
lklimek b7372b2
chore: fix
lklimek 124c8a5
chore: add conventional commits info
lklimek 891870b
chore: adjust claude
lklimek 780ae88
chore: revert out of scope workflow updates
lklimek 89902f8
chore: claude code gh token not needed
lklimek a0d9500
claude.md
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # Only run in Claude Code remote environments | ||
| if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Use sudo only if not already root | ||
| SUDO="" | ||
| if [ "$(id -u)" -ne 0 ]; then | ||
| SUDO="sudo" | ||
| fi | ||
|
|
||
| # Install protoc (Protocol Buffers compiler) if not present | ||
| # Version aligned with CI workflows (.github/workflows/clippy.yml, tests.yml) | ||
| if ! command -v protoc &>/dev/null; then | ||
| PROTOC_VERSION="25.2" | ||
| PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip" | ||
| curl -fsSL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" -o "/tmp/${PROTOC_ZIP}" | ||
| $SUDO unzip -o "/tmp/${PROTOC_ZIP}" -d /usr/local | ||
| rm "/tmp/${PROTOC_ZIP}" | ||
| fi | ||
|
|
||
| # Install Rust components (clippy, rustfmt) if not present | ||
| rustup component add clippy rustfmt 2>/dev/null || true | ||
|
|
||
| # Install system dependencies if not already present | ||
| # Matches CI: build-essential, pkg-config, clang, cmake, libsqlite3-dev, libzmq3-dev | ||
| PACKAGES_TO_INSTALL="" | ||
| for pkg in build-essential pkg-config clang cmake libsqlite3-dev libzmq3-dev unzip; do | ||
| if ! dpkg -s "$pkg" &>/dev/null; then | ||
| PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $pkg" | ||
| fi | ||
| done | ||
|
|
||
| if [ -n "$PACKAGES_TO_INSTALL" ]; then | ||
| $SUDO apt-get update -qq || true | ||
| $SUDO apt-get install -y -qq $PACKAGES_TO_INSTALL | ||
| fi | ||
|
|
||
| # Pre-download Tenderdash proto sources to avoid network fetch during cargo build. | ||
| # | ||
| # The tenderdash-proto build.rs (from rs-tenderdash-abci) downloads proto sources | ||
| # from GitHub during compilation. In sandboxed environments, ureq/rustls can't | ||
| # verify TLS certificates, causing the download to fail. | ||
| # | ||
| # Workaround: Pre-download and extract the sources, then configure Cargo env vars | ||
| # so the build script finds them without needing network access. | ||
| # | ||
| # The build script checks: | ||
| # 1. TENDERDASH_DIR - path to pre-extracted tenderdash sources | ||
| # 2. CARGO_TARGET_DIR - used as the zip archive cache directory | ||
| # | ||
| # Even with TENDERDASH_DIR set, a clean build has no state file, so the build | ||
| # script re-downloads. By also placing the zip in CARGO_TARGET_DIR (the cache dir), | ||
| # the build script finds the cached archive and skips the network download. | ||
| # | ||
| # Version must match DEFAULT_VERSION in rs-tenderdash-abci/proto/build.rs | ||
| TENDERDASH_VERSION="v1.5.3" | ||
| TENDERDASH_DIR="/tmp/tenderdash-${TENDERDASH_VERSION}" | ||
| TENDERDASH_CACHE_DIR="/tmp/tenderdash-cache" | ||
| TENDERDASH_ZIP="${TENDERDASH_CACHE_DIR}/tenderdash-${TENDERDASH_VERSION}.zip" | ||
|
|
||
| if [ ! -d "${TENDERDASH_DIR}/proto" ] || [ ! -f "${TENDERDASH_ZIP}" ]; then | ||
| echo "[session-start] Downloading Tenderdash ${TENDERDASH_VERSION} proto sources..." | ||
| mkdir -p "${TENDERDASH_CACHE_DIR}" | ||
| DOWNLOAD_ZIP="/tmp/tenderdash-download-${TENDERDASH_VERSION}.zip" | ||
| curl -fsSL "https://github.com/dashpay/tenderdash/archive/${TENDERDASH_VERSION}.zip" -o "${DOWNLOAD_ZIP}" | ||
|
|
||
| # Keep a copy in the cache dir for the build script to find | ||
| cp "${DOWNLOAD_ZIP}" "${TENDERDASH_ZIP}" | ||
|
|
||
| # Extract to a known location for TENDERDASH_DIR | ||
| if [ ! -d "${TENDERDASH_DIR}/proto" ]; then | ||
| TMPDIR=$(mktemp -d) | ||
| unzip -q "${DOWNLOAD_ZIP}" -d "${TMPDIR}" | ||
| # The archive extracts to a subdirectory like tenderdash-v1.5.3/ | ||
| EXTRACTED_DIR=$(find "${TMPDIR}" -maxdepth 1 -type d -name "tenderdash-*" | head -1) | ||
| if [ -z "${EXTRACTED_DIR}" ]; then | ||
| echo "[session-start] ERROR: Could not find extracted tenderdash directory" | ||
| rm -rf "${TMPDIR}" "${DOWNLOAD_ZIP}" | ||
| exit 1 | ||
| fi | ||
| rm -rf "${TENDERDASH_DIR}" | ||
| mv "${EXTRACTED_DIR}" "${TENDERDASH_DIR}" | ||
| rm -rf "${TMPDIR}" | ||
| fi | ||
| rm -f "${DOWNLOAD_ZIP}" | ||
| echo "[session-start] Tenderdash proto sources installed to ${TENDERDASH_DIR}" | ||
| fi | ||
|
|
||
| # Set env vars in global Cargo config so build scripts pick them up. | ||
| # - TENDERDASH_DIR: tells the proto-compiler where pre-extracted sources are | ||
| # - CARGO_TARGET_DIR: tells the proto-compiler where to find the cached zip archive | ||
| # (Note: Cargo's [env] table does NOT affect Cargo's own target dir behavior, | ||
| # per Cargo docs. It only sets env vars for build scripts and rustc.) | ||
| # This avoids modifying the project's .cargo/config.toml. | ||
| CARGO_CONFIG_DIR="${HOME}/.cargo" | ||
| CARGO_CONFIG_FILE="${CARGO_CONFIG_DIR}/config.toml" | ||
| mkdir -p "${CARGO_CONFIG_DIR}" | ||
|
|
||
| if ! grep -q "TENDERDASH_DIR" "${CARGO_CONFIG_FILE}" 2>/dev/null; then | ||
| # If the file already has an [env] section, append keys under it. | ||
| # Otherwise, add a new [env] section. Avoids duplicate TOML table headers. | ||
| if grep -q '^\[env\]' "${CARGO_CONFIG_FILE}" 2>/dev/null; then | ||
| # Insert the keys right after the existing [env] line | ||
| sed -i '/^\[env\]/a TENDERDASH_DIR = "'"${TENDERDASH_DIR}"'"\nCARGO_TARGET_DIR = "'"${TENDERDASH_CACHE_DIR}"'"' "${CARGO_CONFIG_FILE}" | ||
| else | ||
| cat >> "${CARGO_CONFIG_FILE}" <<EOF | ||
|
|
||
| [env] | ||
| TENDERDASH_DIR = "${TENDERDASH_DIR}" | ||
| CARGO_TARGET_DIR = "${TENDERDASH_CACHE_DIR}" | ||
| EOF | ||
| fi | ||
| echo "[session-start] Set TENDERDASH_DIR and CARGO_TARGET_DIR in ${CARGO_CONFIG_FILE}" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "hooks": { | ||
| "SessionStart": [ | ||
| { | ||
| "matcher": "startup", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/session-start.sh", | ||
| "timeout": 120 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Claude Code | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issues: | ||
| types: [opened, assigned] | ||
| pull_request_review: | ||
| types: [submitted] | ||
|
|
||
| jobs: | ||
| claude: | ||
| 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'))) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
| id-token: write | ||
| actions: read # Required for Claude to read CI results on PRs | ||
|
lklimek marked this conversation as resolved.
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN_LKLIMEK }} | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Optional: Customize the trigger phrase (default: @claude) | ||
| # trigger_phrase: "/claude" | ||
|
|
||
| # Optional: Trigger when specific user is assigned to an issue | ||
| # assignee_trigger: "claude-bot" | ||
|
|
||
| # Optional: Configure Claude's behavior with CLI arguments | ||
| # claude_args: | | ||
| # --model claude-opus-4-1-20250805 | ||
| # --max-turns 10 | ||
| # --allowedTools "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" | ||
| # --system-prompt "Follow our coding standards. Ensure all new code has tests. Use TypeScript for new files." | ||
|
|
||
| # Optional: Advanced settings configuration | ||
| # settings: | | ||
| # { | ||
| # "env": { | ||
| # "NODE_ENV": "test" | ||
| # } | ||
| # } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.