mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-11 22:50:06 +00:00
feat(core): Add new params to claude task runner github action (no-changelog) (#25766)
This commit is contained in:
@@ -11,6 +11,25 @@ on:
|
||||
description: 'Your GitHub PAT (required for PR authorship - you cannot approve PRs you author)'
|
||||
required: true
|
||||
type: string
|
||||
resumeUrl:
|
||||
description: 'Optional callback URL to call with the result when the workflow completes'
|
||||
required: false
|
||||
type: string
|
||||
createPr:
|
||||
description: 'Create a pull request with the changes'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
model:
|
||||
description: 'Claude model to use (e.g., claude-opus-4-6, claude-sonnet-4-5, claude-haiku-4-5)'
|
||||
required: false
|
||||
type: string
|
||||
default: 'claude-sonnet-4-5-20250929'
|
||||
ref:
|
||||
description: 'Git ref (branch/tag/SHA) to check out and work on'
|
||||
required: false
|
||||
type: string
|
||||
default: 'master'
|
||||
|
||||
jobs:
|
||||
run-claude-task:
|
||||
@@ -29,7 +48,7 @@ jobs:
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
token: ${{ inputs.user_token }}
|
||||
ref: master
|
||||
ref: ${{ inputs.ref }}
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Setup Node.js
|
||||
@@ -94,6 +113,7 @@ jobs:
|
||||
github_token: ${{ inputs.user_token }}
|
||||
prompt: ${{ env.CLAUDE_PROMPT }}
|
||||
claude_args: |
|
||||
--model ${{ inputs.model }}
|
||||
--allowedTools Bash,Read,Write,Edit,Glob,Grep,WebFetch,WebSearch,TodoWrite
|
||||
|
||||
- name: Extract PR title
|
||||
@@ -116,25 +136,29 @@ jobs:
|
||||
TRIGGERED_BY: ${{ github.actor }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
if ! git diff --quiet master; then
|
||||
if ! git diff --quiet "${{ inputs.ref }}"; then
|
||||
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
|
||||
git push -u origin "$BRANCH_NAME"
|
||||
|
||||
{
|
||||
echo "## Summary"
|
||||
echo "Automated task completed by Claude."
|
||||
echo ""
|
||||
echo "### Task Description"
|
||||
echo "$INPUT_TASK"
|
||||
echo ""
|
||||
echo "### Generated by"
|
||||
echo "[Workflow Run #${{ github.run_id }}]($RUN_URL)"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo "*Triggered by @$TRIGGERED_BY via the Claude Task Runner workflow.*"
|
||||
} > /tmp/pr-body.md
|
||||
if [ "${{ inputs.createPr }}" = "true" ]; then
|
||||
{
|
||||
echo "## Summary"
|
||||
echo "Automated task completed by Claude."
|
||||
echo ""
|
||||
echo "### Task Description"
|
||||
echo "$INPUT_TASK"
|
||||
echo ""
|
||||
echo "### Generated by"
|
||||
echo "[Workflow Run #${{ github.run_id }}]($RUN_URL)"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo "*Triggered by @$TRIGGERED_BY via the Claude Task Runner workflow.*"
|
||||
} > /tmp/pr-body.md
|
||||
|
||||
gh pr create --title "$PR_TITLE" --body-file /tmp/pr-body.md --base master
|
||||
gh pr create --title "$PR_TITLE" --body-file /tmp/pr-body.md --base "${{ inputs.ref }}"
|
||||
else
|
||||
echo "::notice::PR creation is disabled. Changes pushed to branch but no PR created."
|
||||
fi
|
||||
else
|
||||
echo "::notice::No changes made by Claude. Skipping PR creation."
|
||||
fi
|
||||
@@ -149,3 +173,21 @@ jobs:
|
||||
echo "**Task:** $INPUT_TASK"
|
||||
echo "**Branch:** $BRANCH_NAME"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Call resume url
|
||||
if: inputs.resumeUrl != ''
|
||||
env:
|
||||
EXECUTION_FILE: ${{ steps.claude.outputs.execution_file }}
|
||||
run: |
|
||||
# Extract only the result message (last element) from Claude's output
|
||||
if [ -f "$EXECUTION_FILE" ]; then
|
||||
jq --arg branch "$BRANCH_NAME" \
|
||||
'{success: true, branch: $branch, result: .[-1]}' "$EXECUTION_FILE" \
|
||||
| curl -X POST "${{ inputs.resumeUrl }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary @-
|
||||
else
|
||||
curl -X POST "${{ inputs.resumeUrl }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"success\": true, \"branch\": \"$BRANCH_NAME\", \"result\": null}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user