Skip to content

Commit 0d02143

Browse files
author
Auto-Co AI
committed
Fix action.yml output to work with both template and AI modes
The description output only referenced steps.generate.outputs.description (template mode). When AI mode was used, the output was empty. - Added set-output step that reads from template step first, falls back to AI step - output.description now references set-output step - Update PR body step also uses set-output Also fixed README claiming the workflow is '5 lines' when it is 15.
1 parent eaae77e commit 0d02143

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DocuCraft automatically generates structured PR descriptions from your pull requ
88

99
## 🚀 Quick Start
1010

11-
Copy this 5-line workflow into `.github/workflows/docucraft.yml`:
11+
Copy this workflow into `.github/workflows/docucraft.yml`:
1212

1313
```yaml
1414
name: DocuCraft

action.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ inputs:
6363

6464
outputs:
6565
description:
66-
description: "The generated PR description"
67-
value: ${{ steps.generate.outputs.description }}
66+
description: "The generated PR description (from template or AI mode)"
67+
value: ${{ steps.set-output.outputs.description }}
6868

6969
changelog-entry:
7070
description: "Generated changelog entry (only set when generate-changelog is true and PR is merged)"
@@ -568,17 +568,26 @@ CHLOG_EOF
568568
echo "PR #$PR_NUMBER was closed but not merged. Skipping changelog."
569569
fi
570570

571+
- name: Collect output description
572+
id: set-output
573+
shell: bash
574+
run: |
575+
DESCRIPTION="${{ steps.generate.outputs.description }}"
576+
if [ -z "$DESCRIPTION" ]; then
577+
DESCRIPTION="${{ steps.generate-ai.outputs.description }}"
578+
fi
579+
echo "description<<EOF" >> $GITHUB_OUTPUT
580+
echo "$DESCRIPTION" >> $GITHUB_OUTPUT
581+
echo "EOF" >> $GITHUB_OUTPUT
582+
571583
- name: Update PR body
572584
shell: bash
573585
env:
574586
GH_TOKEN: ${{ inputs.github-token }}
575587
run: |
576588
PR_NUMBER="${{ steps.diff.outputs.pr_number }}"
577589
PR_STATE="${{ github.event.pull_request.state }}"
578-
DESCRIPTION="${{ steps.generate.outputs.description }}"
579-
if [ -z "$DESCRIPTION" ]; then
580-
DESCRIPTION="${{ steps.generate-ai.outputs.description }}"
581-
fi
590+
DESCRIPTION="${{ steps.set-output.outputs.description }}"
582591
if [ "$PR_STATE" = "open" ] && [ -n "$DESCRIPTION" ]; then
583592
echo "$DESCRIPTION" | gh pr review $PR_NUMBER --body-file - 2>&1 || true
584593
fi

0 commit comments

Comments
 (0)