143 lines
5.7 KiB
YAML
143 lines
5.7 KiB
YAML
name: Claude Assistant for Gitea
|
|
|
|
env:
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/inventory_2?sslmode=disable
|
|
TEST_DATABASE_URL: postgres://postgres:postgres@postgres:5432/inventory_2_test?sslmode=disable
|
|
|
|
on:
|
|
# Trigger on issue comments (works on both issues and pull requests in Gitea)
|
|
issue_comment:
|
|
types: [created]
|
|
# Trigger on issues being opened or assigned
|
|
issues:
|
|
types: [opened, assigned]
|
|
# Note: pull_request_review_comment has limited support in Gitea
|
|
# Use issue_comment instead which covers PR comments
|
|
|
|
jobs:
|
|
claude-assistant:
|
|
# Basic trigger detection - check for @claude in comments or issue body
|
|
if: |
|
|
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || github.event.action == 'assigned'))
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
# Note: Gitea Actions may not require id-token: write for basic functionality
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
#- name: apk update
|
|
# run: |
|
|
# apk update
|
|
|
|
- name: Install psql
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y postgresql-client
|
|
#apk add postgresql-client
|
|
|
|
- name: Setup golang environment
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version: 'stable'
|
|
check-latest: true
|
|
token: ${{ gitea.token }}
|
|
permissions:
|
|
contents: read
|
|
|
|
- name: Install golang-migrate
|
|
run: |
|
|
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
|
|
|
- name: Migrate schema up
|
|
run: |
|
|
migrate -path database_migrations -database "$DATABASE_URL" up
|
|
|
|
## TODO: eliminate, if not needed
|
|
#- name: Setup node environment
|
|
# uses: actions/setup-node@v7
|
|
# with:
|
|
# # Version Spec of the version to use in SemVer notation.
|
|
# #pk It also admits such aliases as lts/*, latest, nightly and canary builds
|
|
# # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node
|
|
# node-version: 24
|
|
|
|
# # Set this option if you want the action to check for the latest available version
|
|
# # that satisfies the version spec.
|
|
# # It will only get affect for lts Nodejs versions (12.x, >=10.15.0, lts/Hydrogen).
|
|
# # Default: false
|
|
# #check-latest: false
|
|
|
|
# package-manager-cache: false # Maybe add caching later
|
|
|
|
# # Used to pull node distributions from https://github.com/actions/node-versions.
|
|
# # Since there's a default, this is typically not supplied by the user.
|
|
# # When running this action on github.com, the default value is sufficient.
|
|
# # When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
|
# #
|
|
# # We recommend using a service account with the least permissions necessary. Also
|
|
# # when generating a new PAT, select the least scopes necessary.
|
|
# #
|
|
# # [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
|
|
# #
|
|
# # Default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
|
# token: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Run Claude Assistant
|
|
uses: markwylde/claude-code-gitea-action@gitea
|
|
with:
|
|
allowed_tools: |
|
|
penpot-self-hosted__execute_code
|
|
penpot-self-hosted__high_level_overview
|
|
penpot-self-hosted__penpot_api_info
|
|
penpot-self-hosted__export_shape
|
|
penpot_self_hosted__execute_code
|
|
penpot_self_hosted__high_level_overview
|
|
penpot_self_hosted__penpot_api_info
|
|
penpot_self_hosted__export_shape
|
|
Bash(go:*)
|
|
Bash(gofmt:*)
|
|
Bash(./tailwind.sh)
|
|
Bash(node -v)
|
|
Bash(npm install)
|
|
Bash(psql:*)
|
|
gitea_api_url: "https://gitea.inventory-plus-plus.com/api/v1"
|
|
gitea_token: ${{ secrets.GITEA_TOKEN }} # Use standard workflow token
|
|
# anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
# Prefer claude_code_oauth_token over anthropic_api_key (cheaper!)
|
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
timeout_minutes: "60"
|
|
trigger_phrase: "@claude"
|
|
assignee_trigger: "@claude"
|
|
# Needed due to bug: https://github.com/anthropics/claude-code-action/issues/1416
|
|
model: "claude-sonnet-5"
|
|
# Optional: Customize for Gitea environment
|
|
custom_instructions: |
|
|
You are working in a Gitea environment. Be aware that:
|
|
- Some GitHub Actions features may behave differently
|
|
- Focus on core functionality and avoid advanced GitHub-specific features
|
|
- Use standard git operations when possible
|
|
env:
|
|
GITEA_SERVER_URL: "https://gitea.inventory-plus-plus.com"
|
|
NODE_VERSION: 24.x
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_PORT: 5432
|