From e171a7635615a19d8c92c81791457f65f395c7b4 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 01:29:53 +0000 Subject: [PATCH 01/10] feat: Add GITHUB_STEP_SUMMARY output to PR comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add step to read GITHUB_STEP_SUMMARY after task execution - Include summary content in PR comments using expandable
block - Only render summary section when content exists - Uses format:
✳️ Show/Hide Summary Output Requested by @aaronsteers Link to Devin run: https://app.devin.ai/sessions/7ec095caed01494693ef260c6a6db2ad Co-Authored-By: AJ Steers --- action.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e0fa450..7f7d7d1 100644 --- a/action.yml +++ b/action.yml @@ -193,6 +193,25 @@ runs: echo "------------------------------------" echo "------------------------------------" + - name: Read task output from step summary + id: read-summary + if: always() + shell: bash + run: | + if [ -f "$GITHUB_STEP_SUMMARY" ] && [ -s "$GITHUB_STEP_SUMMARY" ]; then + echo "Step summary file exists and is non-empty" + # Use multiline output syntax for GitHub Actions + { + echo "content<> $GITHUB_OUTPUT + echo "has_content=true" >> $GITHUB_OUTPUT + else + echo "No step summary content found" + echo "has_content=false" >> $GITHUB_OUTPUT + fi + - name: Auto commit changes id: auto-commit uses: stefanzweifel/git-auto-commit-action@v5 @@ -215,7 +234,7 @@ runs: body: > 🤖 Auto-commit successful: ${{ steps.auto-commit.outputs.commit_hash }} - - name: Append no-op comment + - name: Append success comment with output if: > steps.comment-start.outputs.comment-id uses: peter-evans/create-or-update-comment@v4 @@ -224,6 +243,13 @@ runs: reactions: "+1" body: | > ${{ inputs.success-message || format(' 🟦 Poe command `{0}` completed successfully.', steps.resolve-command.outputs.command) }} + ${{ steps.read-summary.outputs.has_content == 'true' && format(' + +
✳️ Show/Hide Summary Output + + {0} + +
', steps.read-summary.outputs.content) || '' }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id From 9b5ac0cef9ead40ad908ea8287acfa8282dd2f4e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 01:37:28 +0000 Subject: [PATCH 02/10] feat: Add GITHUB_STEP_SUMMARY output to failure comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Include summary output in failure comments using expandable
block - Use ✴️ emoji for failure output (vs ✳️ for success) - Only render summary section when content exists Co-Authored-By: AJ Steers --- action.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 7f7d7d1..fa483d1 100644 --- a/action.yml +++ b/action.yml @@ -257,8 +257,15 @@ runs: with: comment-id: ${{ steps.comment-start.outputs.comment-id }} reactions: confused - body: > - ${{ inputs.failure-message || format('❌ Poe command `{0}` failed. Please inspect the logs.', steps.resolve-command.outputs.command) }} + body: | + > ${{ inputs.failure-message || format('❌ Poe command `{0}` failed. Please inspect the logs.', steps.resolve-command.outputs.command) }} + ${{ steps.read-summary.outputs.has_content == 'true' && format(' + +
✴️ Show/Hide Summary Output + + {0} + +
', steps.read-summary.outputs.content) || '' }} # Create a new PR if no PR was provided From c68ba8e030bb4f0f8330ac011ecdcab9414d93a9 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 01:59:15 +0000 Subject: [PATCH 03/10] test: Add CI workflow to verify GITHUB_STEP_SUMMARY feature - Add test-with-summary task that writes sample markdown to GITHUB_STEP_SUMMARY - Add test-without-summary task as a control (no summary output) - Create ci-tests.yml workflow triggered on PR synchronize events - Only run tests when PR is not in draft status Co-Authored-By: AJ Steers --- .github/workflows/ci-tests.yml | 43 ++++++++++++++++++++++++++++++++++ poe_tasks.toml | 17 ++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/ci-tests.yml diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 0000000..3d4f20c --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,43 @@ +name: CI Tests + +on: + pull_request: + types: [synchronize, opened, reopened, ready_for_review] + +permissions: + contents: write + pull-requests: write + issues: write + +jobs: + test-with-summary: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run `poe test-with-summary` [Poe Command Processor] + uses: ./ + with: + pr: ${{ github.event.pull_request.number }} + github-token: ${{ secrets.GITHUB_TOKEN }} + command: test-with-summary + + test-without-summary: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run `poe test-without-summary` [Poe Command Processor] + uses: ./ + with: + pr: ${{ github.event.pull_request.number }} + github-token: ${{ secrets.GITHUB_TOKEN }} + command: test-without-summary diff --git a/poe_tasks.toml b/poe_tasks.toml index e45f383..c20310e 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -1,3 +1,20 @@ [tasks] test = "echo 'Dummy tests...'" test-fail = "exit 1" + +test-with-summary = """ +if [ -n "$GITHUB_STEP_SUMMARY" ]; then + echo '## Test Results' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo 'This is a test of the GITHUB_STEP_SUMMARY feature.' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '- ✅ Item 1: Success' >> $GITHUB_STEP_SUMMARY + echo '- ✅ Item 2: Success' >> $GITHUB_STEP_SUMMARY + echo '- ✅ Item 3: Success' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '**Status**: All tests passed! 🎉' >> $GITHUB_STEP_SUMMARY +fi +echo 'Test with summary completed' +""" + +test-without-summary = "echo 'Test without summary completed'" From cb84eed6f9aa8de65d52b4dc09460737249027fb Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 02:03:49 +0000 Subject: [PATCH 04/10] fix: Use shell task type for multiline poe commands The test-with-summary task was using invalid syntax for poethepoet. Multiline commands require the 'shell' task type with shell = """...""" syntax. This fixes the CI failure where poe reported: 'Invalid cmd task includes multiple command lines' Co-Authored-By: AJ Steers --- poe_tasks.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/poe_tasks.toml b/poe_tasks.toml index c20310e..0a7afd5 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -2,7 +2,8 @@ test = "echo 'Dummy tests...'" test-fail = "exit 1" -test-with-summary = """ +[tasks.test-with-summary] +shell = """ if [ -n "$GITHUB_STEP_SUMMARY" ]; then echo '## Test Results' >> $GITHUB_STEP_SUMMARY echo '' >> $GITHUB_STEP_SUMMARY @@ -17,4 +18,5 @@ fi echo 'Test with summary completed' """ -test-without-summary = "echo 'Test without summary completed'" +[tasks.test-without-summary] +shell = "echo 'Test without summary completed'" From c6df182eb0eb0f1366807d2c21f2394e72f5f692 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 04:16:44 +0000 Subject: [PATCH 05/10] fix: Use POE_SUMMARY_FILE for task output to fix summary display The previous implementation relied on GITHUB_STEP_SUMMARY being accessible within the composite action, but this file is managed by GitHub Actions and not reliably readable across action steps. Solution: - Create a temporary file (POE_SUMMARY_FILE) at the start of the action - Have tasks write to POE_SUMMARY_FILE instead of GITHUB_STEP_SUMMARY - Read from POE_SUMMARY_FILE in the read-summary step - Copy content to GITHUB_STEP_SUMMARY for job summary visibility - Maintain backward compatibility by falling back to GITHUB_STEP_SUMMARY This ensures dual visibility: task output appears in both the GitHub job summary and the PR comments. Co-Authored-By: AJ Steers --- action.yml | 21 ++++++++++++++++++--- poe_tasks.toml | 23 +++++++++++++---------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index fa483d1..9ba59f4 100644 --- a/action.yml +++ b/action.yml @@ -78,6 +78,15 @@ runs: echo "Resolved command: ${command}" echo command="$command" >> $GITHUB_OUTPUT + - name: Create temp file for task output + id: create-temp-file + shell: bash + run: | + TEMP_FILE=$(mktemp) + echo "summary_file=$TEMP_FILE" >> $GITHUB_OUTPUT + echo "POE_SUMMARY_FILE=$TEMP_FILE" >> $GITHUB_ENV + echo "Created temporary file for task output: $TEMP_FILE" + - name: Get PR info if: inputs.pr id: pr-info @@ -198,15 +207,21 @@ runs: if: always() shell: bash run: | - if [ -f "$GITHUB_STEP_SUMMARY" ] && [ -s "$GITHUB_STEP_SUMMARY" ]; then - echo "Step summary file exists and is non-empty" + SUMMARY_FILE="${POE_SUMMARY_FILE:-$GITHUB_STEP_SUMMARY}" + if [ -f "$SUMMARY_FILE" ] && [ -s "$SUMMARY_FILE" ]; then + echo "Step summary file exists and is non-empty: $SUMMARY_FILE" # Use multiline output syntax for GitHub Actions { echo "content<> $GITHUB_OUTPUT echo "has_content=true" >> $GITHUB_OUTPUT + + # Also write to GITHUB_STEP_SUMMARY for job summary visibility + if [ -n "$GITHUB_STEP_SUMMARY" ] && [ "$SUMMARY_FILE" != "$GITHUB_STEP_SUMMARY" ]; then + cat "$SUMMARY_FILE" >> "$GITHUB_STEP_SUMMARY" + fi else echo "No step summary content found" echo "has_content=false" >> $GITHUB_OUTPUT diff --git a/poe_tasks.toml b/poe_tasks.toml index 0a7afd5..b19d4dd 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -4,16 +4,19 @@ test-fail = "exit 1" [tasks.test-with-summary] shell = """ -if [ -n "$GITHUB_STEP_SUMMARY" ]; then - echo '## Test Results' >> $GITHUB_STEP_SUMMARY - echo '' >> $GITHUB_STEP_SUMMARY - echo 'This is a test of the GITHUB_STEP_SUMMARY feature.' >> $GITHUB_STEP_SUMMARY - echo '' >> $GITHUB_STEP_SUMMARY - echo '- ✅ Item 1: Success' >> $GITHUB_STEP_SUMMARY - echo '- ✅ Item 2: Success' >> $GITHUB_STEP_SUMMARY - echo '- ✅ Item 3: Success' >> $GITHUB_STEP_SUMMARY - echo '' >> $GITHUB_STEP_SUMMARY - echo '**Status**: All tests passed! 🎉' >> $GITHUB_STEP_SUMMARY +# Determine which file to write to (prefer POE_SUMMARY_FILE, fall back to GITHUB_STEP_SUMMARY) +OUTPUT_FILE="${POE_SUMMARY_FILE:-$GITHUB_STEP_SUMMARY}" + +if [ -n "$OUTPUT_FILE" ]; then + echo '## Test Results' >> "$OUTPUT_FILE" + echo '' >> "$OUTPUT_FILE" + echo 'This is a test of the GITHUB_STEP_SUMMARY feature.' >> "$OUTPUT_FILE" + echo '' >> "$OUTPUT_FILE" + echo '- ✅ Item 1: Success' >> "$OUTPUT_FILE" + echo '- ✅ Item 2: Success' >> "$OUTPUT_FILE" + echo '- ✅ Item 3: Success' >> "$OUTPUT_FILE" + echo '' >> "$OUTPUT_FILE" + echo '**Status**: All tests passed! 🎉' >> "$OUTPUT_FILE" fi echo 'Test with summary completed' """ From d51646a35d2783dfb3fb180b451053fcb4854c11 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 05:05:03 +0000 Subject: [PATCH 06/10] docs: Add GITHUB_STEP_SUMMARY usage to README Co-Authored-By: AJ Steers --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index be14873..f400267 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,37 @@ If a `.tool-versions` file does not exist, or doesn't have versions specified, w - `poetry` - Default to latest version. - `python` - Default to version 3.11. +## Publishing Task Output + +Tasks can optionally publish markdown output that will appear in both the GitHub job summary and as an expandable section in PR comments. This is useful for displaying test results, coverage reports, or other structured output. + +### How It Works + +To publish output, your poe task should check for the `GITHUB_STEP_SUMMARY` environment variable and write markdown content to it: + +```shell +# In your poe task (pyproject.toml or poe_tasks.toml) +[tasks.my-task] +shell = """ +if [ -n "$GITHUB_STEP_SUMMARY" ]; then + echo '## Task Results' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '- ✅ Step 1: Success' >> $GITHUB_STEP_SUMMARY + echo '- ✅ Step 2: Success' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '**Status**: All steps completed! 🎉' >> $GITHUB_STEP_SUMMARY +fi +# Your actual task logic here +echo 'Task completed' +""" +``` + +The output will appear: +- In the GitHub Actions job summary (visible in the workflow run page) +- In PR comments as an expandable section with ✳️ "Show/Hide Summary Output" (on success) or ✴️ (on failure) + +**Note:** Always check if `GITHUB_STEP_SUMMARY` is defined before writing to it, as this variable is only available in GitHub Actions environments. + ## Sample Workflows ### Sample Poe Slash Command (Generic) From a28a3bc3d7dd1fcdfc15fe34f806ea62e2763cca Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 05:09:50 +0000 Subject: [PATCH 07/10] refactor: Simplify to use GITHUB_STEP_SUMMARY directly, remove POE_SUMMARY_FILE Co-Authored-By: AJ Steers --- action.yml | 21 +++------------------ poe_tasks.toml | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/action.yml b/action.yml index 9ba59f4..1b87f1f 100644 --- a/action.yml +++ b/action.yml @@ -78,15 +78,6 @@ runs: echo "Resolved command: ${command}" echo command="$command" >> $GITHUB_OUTPUT - - name: Create temp file for task output - id: create-temp-file - shell: bash - run: | - TEMP_FILE=$(mktemp) - echo "summary_file=$TEMP_FILE" >> $GITHUB_OUTPUT - echo "POE_SUMMARY_FILE=$TEMP_FILE" >> $GITHUB_ENV - echo "Created temporary file for task output: $TEMP_FILE" - - name: Get PR info if: inputs.pr id: pr-info @@ -207,21 +198,15 @@ runs: if: always() shell: bash run: | - SUMMARY_FILE="${POE_SUMMARY_FILE:-$GITHUB_STEP_SUMMARY}" - if [ -f "$SUMMARY_FILE" ] && [ -s "$SUMMARY_FILE" ]; then - echo "Step summary file exists and is non-empty: $SUMMARY_FILE" + if [ -n "$GITHUB_STEP_SUMMARY" ] && [ -f "$GITHUB_STEP_SUMMARY" ] && [ -s "$GITHUB_STEP_SUMMARY" ]; then + echo "Step summary file exists and is non-empty: $GITHUB_STEP_SUMMARY" # Use multiline output syntax for GitHub Actions { echo "content<> $GITHUB_OUTPUT echo "has_content=true" >> $GITHUB_OUTPUT - - # Also write to GITHUB_STEP_SUMMARY for job summary visibility - if [ -n "$GITHUB_STEP_SUMMARY" ] && [ "$SUMMARY_FILE" != "$GITHUB_STEP_SUMMARY" ]; then - cat "$SUMMARY_FILE" >> "$GITHUB_STEP_SUMMARY" - fi else echo "No step summary content found" echo "has_content=false" >> $GITHUB_OUTPUT diff --git a/poe_tasks.toml b/poe_tasks.toml index b19d4dd..d6032bd 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -4,19 +4,16 @@ test-fail = "exit 1" [tasks.test-with-summary] shell = """ -# Determine which file to write to (prefer POE_SUMMARY_FILE, fall back to GITHUB_STEP_SUMMARY) -OUTPUT_FILE="${POE_SUMMARY_FILE:-$GITHUB_STEP_SUMMARY}" - -if [ -n "$OUTPUT_FILE" ]; then - echo '## Test Results' >> "$OUTPUT_FILE" - echo '' >> "$OUTPUT_FILE" - echo 'This is a test of the GITHUB_STEP_SUMMARY feature.' >> "$OUTPUT_FILE" - echo '' >> "$OUTPUT_FILE" - echo '- ✅ Item 1: Success' >> "$OUTPUT_FILE" - echo '- ✅ Item 2: Success' >> "$OUTPUT_FILE" - echo '- ✅ Item 3: Success' >> "$OUTPUT_FILE" - echo '' >> "$OUTPUT_FILE" - echo '**Status**: All tests passed! 🎉' >> "$OUTPUT_FILE" +if [ -n "$GITHUB_STEP_SUMMARY" ]; then + echo '## Test Results' >> "$GITHUB_STEP_SUMMARY" + echo '' >> "$GITHUB_STEP_SUMMARY" + echo 'This is a test of the GITHUB_STEP_SUMMARY feature.' >> "$GITHUB_STEP_SUMMARY" + echo '' >> "$GITHUB_STEP_SUMMARY" + echo '- ✅ Item 1: Success' >> "$GITHUB_STEP_SUMMARY" + echo '- ✅ Item 2: Success' >> "$GITHUB_STEP_SUMMARY" + echo '- ✅ Item 3: Success' >> "$GITHUB_STEP_SUMMARY" + echo '' >> "$GITHUB_STEP_SUMMARY" + echo '**Status**: All tests passed! 🎉' >> "$GITHUB_STEP_SUMMARY" fi echo 'Test with summary completed' """ From 76ea61fcae18d142793907ee00d8ae8c33d054ef Mon Sep 17 00:00:00 2001 From: "Aaron (\"AJ\") Steers" Date: Sat, 11 Oct 2025 05:57:05 -0700 Subject: [PATCH 08/10] combine into one step --- action.yml | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/action.yml b/action.yml index 1b87f1f..9ab1932 100644 --- a/action.yml +++ b/action.yml @@ -179,13 +179,17 @@ runs: - name: Run `poe ${{ steps.resolve-command.outputs.command }}` shell: bash + id: run-poe-task run: | + set -euo pipefail + + set +e # Temporarily disable exit on error to capture exit code + poe ${{ steps.resolve-command.outputs.command }} - - name: Print Post-Run Marker - if: always() - shell: bash - run: | + EXIT_CODE=$? + set -e # Re-enable exit on error + # Printing Post-Run Marker echo "------------------------------------" echo "------------------------------------" @@ -193,24 +197,21 @@ runs: echo "------------------------------------" echo "------------------------------------" - - name: Read task output from step summary - id: read-summary - if: always() - shell: bash - run: | - if [ -n "$GITHUB_STEP_SUMMARY" ] && [ -f "$GITHUB_STEP_SUMMARY" ] && [ -s "$GITHUB_STEP_SUMMARY" ]; then + if [ -s "$GITHUB_STEP_SUMMARY" ]; then echo "Step summary file exists and is non-empty: $GITHUB_STEP_SUMMARY" # Use multiline output syntax for GitHub Actions { - echo "content<> $GITHUB_OUTPUT - echo "has_content=true" >> $GITHUB_OUTPUT + echo "__POE_EOF__" + } >> "$GITHUB_OUTPUT" else - echo "No step summary content found" - echo "has_content=false" >> $GITHUB_OUTPUT + echo "No step summary content found." + echo "has-summary=false" >> $GITHUB_OUTPUT + echo "summary-text=" >> $GITHUB_OUTPUT fi + exit "$EXIT_CODE" - name: Auto commit changes id: auto-commit @@ -243,13 +244,13 @@ runs: reactions: "+1" body: | > ${{ inputs.success-message || format(' 🟦 Poe command `{0}` completed successfully.', steps.resolve-command.outputs.command) }} - ${{ steps.read-summary.outputs.has_content == 'true' && format(' - + ${{ steps.run-poe-task.outputs.has-summary == 'true' && format(' +
✳️ Show/Hide Summary Output - + {0} - -
', steps.read-summary.outputs.content) || '' }} + +
', steps.run-poe-task.outputs.content) || '' }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id @@ -259,13 +260,13 @@ runs: reactions: confused body: | > ${{ inputs.failure-message || format('❌ Poe command `{0}` failed. Please inspect the logs.', steps.resolve-command.outputs.command) }} - ${{ steps.read-summary.outputs.has_content == 'true' && format(' - + ${{ steps.run-poe-task.outputs.has-summary == 'true' && format(' +
✴️ Show/Hide Summary Output - + {0} - -
', steps.read-summary.outputs.content) || '' }} + +
', steps.run-poe-task.outputs.summary-text) || '' }} # Create a new PR if no PR was provided From 98d6b85abe2f7c8ba7681d0e1390a80114d63e56 Mon Sep 17 00:00:00 2001 From: "Aaron (\"AJ\") Steers" Date: Sat, 11 Oct 2025 05:59:26 -0700 Subject: [PATCH 09/10] Apply suggestion from @aaronsteers --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9ab1932..5756c9f 100644 --- a/action.yml +++ b/action.yml @@ -250,7 +250,7 @@ runs: {0} -
', steps.run-poe-task.outputs.content) || '' }} + ', steps.run-poe-task.outputs.summary-text) || '' }} - name: Append failure comment if: failure() && steps.comment-start.outputs.comment-id From f154f42a2af90bf9f43222b4aa76f1167c650c7b Mon Sep 17 00:00:00 2001 From: "Aaron (\"AJ\") Steers" Date: Sat, 11 Oct 2025 06:07:32 -0700 Subject: [PATCH 10/10] add test-fail-with-summary --- .github/workflows/ci-tests.yml | 29 +++++++++++++++++++++++------ poe_tasks.toml | 22 ++++++++++++++++++---- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 3d4f20c..3f2c697 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -10,7 +10,7 @@ permissions: issues: write jobs: - test-with-summary: + test-success: runs-on: ubuntu-latest if: github.event.pull_request.draft == false steps: @@ -19,14 +19,14 @@ jobs: with: fetch-depth: 1 - - name: Run `poe test-with-summary` [Poe Command Processor] + - name: Run `poe test-success` [Poe Command Processor] uses: ./ with: pr: ${{ github.event.pull_request.number }} github-token: ${{ secrets.GITHUB_TOKEN }} - command: test-with-summary + command: test-success - test-without-summary: + test-success-with-summary: runs-on: ubuntu-latest if: github.event.pull_request.draft == false steps: @@ -35,9 +35,26 @@ jobs: with: fetch-depth: 1 - - name: Run `poe test-without-summary` [Poe Command Processor] + - name: Run `poe test-success-with-summary` [Poe Command Processor] uses: ./ with: pr: ${{ github.event.pull_request.number }} github-token: ${{ secrets.GITHUB_TOKEN }} - command: test-without-summary + command: test-success-with-summary + + test-fail-with-summary: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run `poe test-fail-with-summary` [Poe Command Processor] + uses: ./ + continue-on-error: true + with: + pr: ${{ github.event.pull_request.number }} + github-token: ${{ secrets.GITHUB_TOKEN }} + command: test-fail-with-summary diff --git a/poe_tasks.toml b/poe_tasks.toml index d6032bd..d65fc43 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -1,8 +1,8 @@ [tasks] -test = "echo 'Dummy tests...'" +test-success = "echo 'Dummy tests...'" test-fail = "exit 1" -[tasks.test-with-summary] +[tasks.test-success-with-summary] shell = """ if [ -n "$GITHUB_STEP_SUMMARY" ]; then echo '## Test Results' >> "$GITHUB_STEP_SUMMARY" @@ -18,5 +18,19 @@ fi echo 'Test with summary completed' """ -[tasks.test-without-summary] -shell = "echo 'Test without summary completed'" +[tasks.test-fail-with-summary] +shell = """ +if [ -n "$GITHUB_STEP_SUMMARY" ]; then + echo '## Test Results' >> "$GITHUB_STEP_SUMMARY" + echo '' >> "$GITHUB_STEP_SUMMARY" + echo 'This is a test of the GITHUB_STEP_SUMMARY feature.' >> "$GITHUB_STEP_SUMMARY" + echo '' >> "$GITHUB_STEP_SUMMARY" + echo '- ✅ Item 1: Success' >> "$GITHUB_STEP_SUMMARY" + echo '- ✅ Item 2: Success' >> "$GITHUB_STEP_SUMMARY" + echo '- 😵 Item 3: Failure!!' >> "$GITHUB_STEP_SUMMARY" + echo '' >> "$GITHUB_STEP_SUMMARY" + echo '**ERROR**: Something bad happened ☠️' >> "$GITHUB_STEP_SUMMARY" +fi +echo 'Test fail with summary completed' +exit 1 +"""