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
36 changes: 23 additions & 13 deletions .github/workflows/auto-documentation.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
name: Auto Documentation

on:
pull_request:
branches: [main]
types: [opened, ready_for_review, reopened, synchronize]
paths:
- "source/**"
- "plugins/**"

concurrency:
group: auto-doc
cancel-in-progress: true
workflow_dispatch:
workflow_call:

permissions:
contents: write
Expand All @@ -20,7 +12,6 @@ permissions:
jobs:
auto-documentation:
name: Generate Documentation
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 15

Expand All @@ -29,7 +20,7 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0

- name: Check if last commit was auto-documentation
Expand Down Expand Up @@ -99,6 +90,25 @@ jobs:
## Expected Output:
Create or modify files in the `wiki/` directory as needed. I will review these changes as part of the PR.

- name: Remove Claude Attribution
if: steps.check-auto-commit.outputs.auto-commit == 'false' && steps.changed-files.outputs.has-apex-changes == 'true'
run: |
BRANCH="${{ github.head_ref || github.ref_name }}"
BASE=$(git rev-parse "origin/${BRANCH}" 2>/dev/null || echo "")
if [ -z "$BASE" ]; then
echo "Cannot determine base commit; skipping attribution cleanup"
exit 0
fi
if git log --format="%B" "${BASE}..HEAD" 2>/dev/null | grep -qi "co-authored-by.*claude"; then
echo "Stripping Claude Co-authored-by trailers from new commits..."
GIT_SEQUENCE_EDITOR="sed -i 's/^pick /reword /g'" \
GIT_EDITOR="sed -i '/[Cc]o-[Aa]uthored-[Bb]y.*[Cc]laude/d'" \
git rebase -i "${BASE}"
git push origin "HEAD:${BRANCH}" --force
else
echo "No Claude attribution found in new commits"
fi

- name: Check if Home.md Changed
if: steps.check-auto-commit.outputs.auto-commit == 'false'
id: check-home
Expand Down Expand Up @@ -147,4 +157,4 @@ jobs:

Generated documentation for new global classes/methods/properties"

git push origin ${{ github.head_ref }}
git push origin ${{ github.head_ref || github.ref_name }}
93 changes: 48 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
- main
types: [opened, ready_for_review, reopened, synchronize]
paths:
- "source/**"
- "plugins/**"
- "src/**"
- ".github/**"

concurrency:
Expand All @@ -32,40 +31,9 @@ permissions:
pull-requests: write

jobs:
claude-review:
name: Claude Code Review
if: ${{ '! github.event.pull_request.draft' }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@beta
with:
allowed_bots: "claude"
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
direct_prompt: |
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

scan:
name: Run Static Analysis
if: ${{ '! github.event.pull_request.draft' }}
if: ${{ !github.event.pull_request.draft && !contains(github.actor, '[bot]') }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -84,7 +52,7 @@ jobs:
# Ensure this check only runs against changed files in the current PR; not the entire codebase
set -euo pipefail
mkdir "$CHANGES_DIR"
sf sgd source delta --generate-delta --from "HEAD^" --to "HEAD" --output-dir "$CHANGES_DIR"/ --source-dir "source/"
sf sgd source delta --generate-delta --from "HEAD^" --to "HEAD" --output-dir "$CHANGES_DIR"/ --source-dir "src/"
echo "Changed files:"
ls "$CHANGES_DIR"

Expand Down Expand Up @@ -120,23 +88,21 @@ jobs:
if: ${{ steps.scan.outputs.num-violations-above-threshold > 0 }}
run: |
# If any violations above the specified threshold, post the results to the PR and fail the check:
NUM_VIOLATIONS=${{ steps.scan.outputs.num-violations-above-threshold}}
NUM_VIOLATIONS=${{ steps.scan.outputs.num-violations-above-threshold }}
echo "⚠️ Detected $NUM_VIOLATIONS violations that meet/exceed the set threshold. View the job summary for more details:"
echo "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
exit 1

run-unit-tests:
name: Run Unit Tests
if: ${{ '! github.event.pull_request.draft' }}
if: ${{ !github.event.pull_request.draft && !contains(github.actor, '[bot]') }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup SF CLI
uses: ./.github/actions/setup-sf-cli

- name: Authenticate Devhub
env:
CLIENT_ID: ${{ secrets.SALESFORCE_CONSUMER_KEY }}
Expand All @@ -150,7 +116,6 @@ jobs:
--jwt-key-file server.key \
--set-default-dev-hub \
--username "$USERNAME"

- name: Get Existing Scratch Org
id: get-existing
continue-on-error: true
Expand All @@ -177,7 +142,6 @@ jobs:
--username "$USERNAME"
echo "success=true" >> "$GITHUB_OUTPUT"
fi

- name: Create Scratch Org
if: ${{ steps.get-existing.outputs.success != 'true' }}
run: |
Expand All @@ -192,18 +156,17 @@ jobs:
--set-default \
--username "$USERNAME" \
--wait 10

- name: Run Tests
run: |
# Note: Tests for plugins packages aren't supported at this time:
sf project deploy start \
--coverage-formatters json-summary \
--dry-run \
--ignore-conflicts \
--source-dir source \
--source-dir src/core \
--test-level RunLocalTests \
--verbose \
--wait 30

- name: Check Code Coverage
run: |
# Parse the JSON coverage summary file to extract overall coverage percentage
Expand All @@ -213,7 +176,47 @@ jobs:
echo "❌ Code coverage is ${COVERAGE_PERCENT}%, but >= 99% is required"
exit 1
fi

- name: Post Authenticate Devhub
if: ${{ always() }}
run: rm -f server.key

claude-review:
name: Claude Code Review
needs: [scan, run-unit-tests]
if: ${{ !github.event.pull_request.draft && !contains(github.actor, '[bot]') }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@beta
with:
allowed_bots: "claude"
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
direct_prompt: |
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

generate-docs:
name: Generate Documentation
needs: [scan, run-unit-tests]
if: ${{ !github.event.pull_request.draft && !contains(github.actor, '[bot]') }}
uses: ./.github/workflows/auto-documentation.yml
permissions:
contents: write
pull-requests: write
id-token: write
secrets: inherit
Loading
Loading