diff --git a/claude-agent.yml b/claude-agent.yml new file mode 100644 index 0000000..db087d5 --- /dev/null +++ b/claude-agent.yml @@ -0,0 +1,79 @@ + +on: + workflow_call: + inputs: + gitea_api_url: + description: 'https://git.moujtahid.com/api/v1' + required: true + type: string + trigger_phrase: + description: 'Trigger-Phrase (default: @claude)' + required: false + type: string + default: '@claude' + timeout_minutes: + description: 'Max. Laufzeit in Minuten' + required: false + type: string + default: '30' + custom_instructions: + description: 'Zusätzliche Instructions – werden an die Standard-Instructions angehängt' + required: false + type: string + default: '' + secrets: + GITEA_TOKEN: + required: true + CLAUDE_CODE_OAUTH_TOKEN: + required: true + +jobs: + claude: + runs-on: ubuntu-latest + + if: | + (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) || + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build custom instructions + id: instructions + run: | + BASE="Du arbeitest in einer selbst gehosteten Gitea-Instanz. + Schreibe Code auf Englisch kommentiert wenn nicht anders angegeben. + Erstelle immer einen PR mit einem klaren Titel und einer Beschreibung was geändert wurde. + Bei NextJS Projekten verwende shadcn und tanstack-query wenn nicht anders angegeben. + Bei NestJS Projekten verwende drizzle, swagger-ui, API-Keys und cors mit localhost:3000-3005 freigabe wenn nicht anders angegeben." + + EXTRA="${{ inputs.custom_instructions }}" + + if [ -n "$EXTRA" ]; then + echo "value<> $GITEA_OUTPUT + echo "$BASE" >> $GITEA_OUTPUT + echo "" >> $GITEA_OUTPUT + echo "$EXTRA" >> $GITEA_OUTPUT + echo "EOF" >> $GITEA_OUTPUT + else + echo "value<> $GITEA_OUTPUT + echo "$BASE" >> $GITEA_OUTPUT + echo "EOF" >> $GITEA_OUTPUT + fi + + + - name: Run Claude Agent + uses: markwylde/claude-code-gitea-action@v1.0.5 + with: + gitea_token: ${{ secrets.GITEA_TOKEN }} + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + gitea_api_url: ${{ inputs.gitea_api_url }} + trigger_phrase: ${{ inputs.trigger_phrase }} + timeout_minutes: ${{ inputs.timeout_minutes }} + claude_git_name: 'Claude@Moujtahid' + claude_git_email: 'claude@moujtahid.com' + custom_instructions: ${{ steps.instructions.outputs.value }} \ No newline at end of file