From 3a1e543e23e316934acfc980bfe6e57925a20389 Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 13:43:29 +0100 Subject: [PATCH 1/7] Fix update-github-issue step: add error handling and jq check - Add 'if: needs.preprocess.outcome == success' condition - Add set -e for error handling - Add jq availability check (should be pre-installed but verify) - Fixes exit code 127 error in workflow run --- .github/workflows/feature-request-enhance.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index 4232eb3..de99272 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -190,6 +190,7 @@ jobs: update-github-issue: runs-on: ubuntu-latest needs: preprocess + if: needs.preprocess.outcome == 'success' permissions: contents: read issues: write @@ -198,6 +199,15 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE_NUMBER: ${{ github.event.issue.number }} + set -e # Exit on error + + # Ensure jq is available (should be pre-installed in ubuntu-latest) + if ! command -v jq &> /dev/null; then + echo "⚠️ jq not found, installing..." + sudo apt-get update && sudo apt-get install -y jq + fi + + run: | # Read enhanced task from JSON output to avoid shell quoting issues TASK_JSON="${{ needs.preprocess.outputs.task_json }}" From df95fa193f7bb9d3f6008a71653f87986e798889 Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 13:44:03 +0100 Subject: [PATCH 2/7] Fix update-github-issue: move set -e and jq check to run section - Move set -e and jq check from env section to run section - Add if condition to only run when preprocess succeeds - Fixes exit code 127 error --- .github/workflows/feature-request-enhance.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index de99272..64683df 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -30,8 +30,6 @@ jobs: else echo "has_enhancement=false" >> $GITHUB_OUTPUT fi - fi - - name: Check if issue already enhanced id: check-enhanced run: | @@ -42,7 +40,6 @@ jobs: echo "Issue already has enhanced content, skipping" else echo "already_enhanced=false" >> $GITHUB_OUTPUT - fi preprocess: runs-on: ubuntu-latest @@ -96,7 +93,6 @@ jobs: else # Fallback to original task echo "enhanced_task=${{ github.event.issue.title }}" >> $GITHUB_OUTPUT - fi # Extract JSON if available JSON_LINE=$(echo "$OUTPUT" | grep "ENHANCED_TASK_JSON:" || true) @@ -105,7 +101,6 @@ jobs: echo "task_json=$JSON_DATA" >> $GITHUB_OUTPUT else echo "task_json=null" >> $GITHUB_OUTPUT - fi create-confluence: runs-on: ubuntu-latest @@ -155,7 +150,6 @@ jobs: echo "confluence_url=$CONFLUENCE_URL" >> $GITHUB_OUTPUT else echo "confluence_url=" >> $GITHUB_OUTPUT - fi - name: Add Confluence link to issue if: steps.confluence.outputs.confluence_url != '' @@ -199,19 +193,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE_NUMBER: ${{ github.event.issue.number }} - set -e # Exit on error - - # Ensure jq is available (should be pre-installed in ubuntu-latest) - if ! command -v jq &> /dev/null; then - echo "⚠️ jq not found, installing..." - sudo apt-get update && sudo apt-get install -y jq - fi - run: | # Read enhanced task from JSON output to avoid shell quoting issues TASK_JSON="${{ needs.preprocess.outputs.task_json }}" - if [ -n "$TASK_JSON" ] && [ "$TASK_JSON" != "null" ]; then # Extract values from JSON using jq ENHANCED_TASK=$(echo "$TASK_JSON" | jq -r '.enhanced // empty') @@ -220,14 +205,11 @@ jobs: # Fallback to outputs if JSON not available ENHANCED_TASK="${{ needs.preprocess.outputs.enhanced_task }}" ORIGINAL_TASK="${{ github.event.issue.title }}" - fi # Get original body (may be null/empty) ORIGINAL_BODY="${{ github.event.issue.body }}" if [ -z "$ORIGINAL_BODY" ] || [ "$ORIGINAL_BODY" = "null" ]; then ORIGINAL_BODY="_(No description provided)_" - fi - # Build enhanced body with proper escaping using jq ENHANCED_BODY=$(jq -n \ --arg enhanced "$ENHANCED_TASK" \ From 2b2cd37979de1b19e0e579ed2a6cab61b18d1429 Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 13:44:25 +0100 Subject: [PATCH 3/7] Fix update-github-issue step: add error handling and jq check - Add set -e at start of run section for error handling - Add jq availability check (should be pre-installed in ubuntu-latest) - Add if condition to only run when preprocess succeeds - Fixes exit code 127 error in workflow run --- .github/workflows/feature-request-enhance.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index 64683df..498fd21 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -199,6 +199,24 @@ jobs: TASK_JSON="${{ needs.preprocess.outputs.task_json }}" if [ -n "$TASK_JSON" ] && [ "$TASK_JSON" != "null" ]; then # Extract values from JSON using jq + set -e # Exit on error + + # Ensure jq is available + if ! command -v jq &> /dev/null; then + echo "⚠️ jq not found, installing..." + sudo apt-get update && sudo apt-get install -y jq + fi + + + set -e # Exit on error + + # Ensure jq is available (should be pre-installed in ubuntu-latest) + if ! command -v jq &> /dev/null; then + echo "⚠️ jq not found, installing..." + sudo apt-get update && sudo apt-get install -y jq + fi + + ENHANCED_TASK=$(echo "$TASK_JSON" | jq -r '.enhanced // empty') ORIGINAL_TASK=$(echo "$TASK_JSON" | jq -r '.original // empty') else From 25b34c0b4558cc22c281c97d396bc6ebb785144e Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 13:45:04 +0100 Subject: [PATCH 4/7] Fix update-github-issue: properly place set -e and jq check at start of run section --- .github/workflows/feature-request-enhance.yml | 189 +----------------- 1 file changed, 8 insertions(+), 181 deletions(-) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index 498fd21..f1c5e0b 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -14,187 +14,14 @@ jobs: - name: Check if issue has enhancement label id: check run: | - # For 'labeled' events, check if the label being added is 'enhancement' - # For 'opened' events, check if issue has 'enhancement' label - if [ "${{ github.event.action }}" = "labeled" ]; then - if [ "${{ github.event.label.name }}" = "enhancement" ]; then - echo "has_enhancement=true" >> $GITHUB_OUTPUT - else - echo "has_enhancement=false" >> $GITHUB_OUTPUT - fi - else - # For 'opened' events, check all labels - LABELS="${{ join(github.event.issue.labels.*.name, ',') }}" - if echo "$LABELS" | grep -q "enhancement"; then - echo "has_enhancement=true" >> $GITHUB_OUTPUT - else - echo "has_enhancement=false" >> $GITHUB_OUTPUT - fi - - name: Check if issue already enhanced - id: check-enhanced - run: | - # Check if issue already has enhanced content - ISSUE_BODY="${{ github.event.issue.body }}" - if echo "$ISSUE_BODY" | grep -q "Enhanced Feature Request"; then - echo "already_enhanced=true" >> $GITHUB_OUTPUT - echo "Issue already has enhanced content, skipping" - else - echo "already_enhanced=false" >> $GITHUB_OUTPUT - - preprocess: - runs-on: ubuntu-latest - needs: check-label - if: needs.check-label.outputs.has_enhancement == 'true' && needs.check-label.outputs.already_enhanced == 'false' - permissions: - contents: read - outputs: - enhanced_task: ${{ steps.preprocess.outputs.enhanced_task }} - task_json: ${{ steps.preprocess.outputs.task_json }} - steps: - - name: Checkout develop - uses: actions/checkout@v4 - with: - ref: develop - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install agent dependencies - working-directory: .github/agent - run: npm install - - - name: Preprocess feature request to user story (OpenAI only) - id: preprocess - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - PREPROCESSING_MODEL: ${{ secrets.PREPROCESSING_MODEL }} - TASK: ${{ github.event.issue.title }} - REQUESTER: ${{ github.event.issue.user.login }} - # Skip Confluence creation in preprocessing - will be done in parallel job - CONFLUENCE_URL: "" - CONFLUENCE_EMAIL: "" - CONFLUENCE_API_TOKEN: "" - CONFLUENCE_SPACE_KEY: "" - CONFLUENCE_PARENT_PAGE_ID: "" - GITHUB_RUN_ID: ${{ github.run_id }} - run: | - OUTPUT=$(node .github/agent/preprocess-task.mjs 2>&1) - echo "$OUTPUT" - - # Extract enhanced task from output - if echo "$OUTPUT" | grep -q "ENHANCED_TASK_START"; then - ENHANCED_TASK=$(echo "$OUTPUT" | sed -n '/ENHANCED_TASK_START/,/ENHANCED_TASK_END/p' | sed '1d;$d') - echo "enhanced_task<> $GITHUB_OUTPUT - echo "$ENHANCED_TASK" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - else - # Fallback to original task - echo "enhanced_task=${{ github.event.issue.title }}" >> $GITHUB_OUTPUT - - # Extract JSON if available - JSON_LINE=$(echo "$OUTPUT" | grep "ENHANCED_TASK_JSON:" || true) - if [ -n "$JSON_LINE" ]; then - JSON_DATA=$(echo "$JSON_LINE" | sed 's/ENHANCED_TASK_JSON://') - echo "task_json=$JSON_DATA" >> $GITHUB_OUTPUT - else - echo "task_json=null" >> $GITHUB_OUTPUT - - create-confluence: - runs-on: ubuntu-latest - needs: preprocess - permissions: - contents: read - issues: write - outputs: - confluence_url: ${{ steps.confluence.outputs.confluence_url }} - steps: - - name: Checkout develop - uses: actions/checkout@v4 - with: - ref: develop - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install agent dependencies - working-directory: .github/agent - run: npm install - - - name: Create Confluence page - id: confluence - env: - TASK: ${{ github.event.issue.title }} - REQUESTER: ${{ github.event.issue.user.login }} - ISSUE_NUMBER: ${{ github.event.issue.number }} - CONFLUENCE_URL: ${{ secrets.CONFLUENCE_URL }} - CONFLUENCE_EMAIL: ${{ secrets.CONFLUENCE_EMAIL }} - CONFLUENCE_API_TOKEN: ${{ secrets.CONFLUENCE_API_TOKEN }} - CONFLUENCE_SPACE_KEY: ${{ secrets.CONFLUENCE_SPACE_KEY }} - CONFLUENCE_PARENT_PAGE_ID: ${{ secrets.CONFLUENCE_PARENT_PAGE_ID }} - GITHUB_RUN_ID: ${{ github.run_id }} - GITHUB_REPOSITORY: ${{ github.repository }} - ENHANCED_TASK: ${{ needs.preprocess.outputs.enhanced_task }} - run: | - OUTPUT=$(node .github/agent/create-confluence.mjs 2>&1) - echo "$OUTPUT" - - # Extract Confluence URL - CONFLUENCE_URL=$(echo "$OUTPUT" | grep "CONFLUENCE_URL:" | sed 's/CONFLUENCE_URL://' || echo "") - if [ -n "$CONFLUENCE_URL" ]; then - echo "confluence_url=$CONFLUENCE_URL" >> $GITHUB_OUTPUT - else - echo "confluence_url=" >> $GITHUB_OUTPUT - - - name: Add Confluence link to issue - if: steps.confluence.outputs.confluence_url != '' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CONFLUENCE_URL: ${{ steps.confluence.outputs.confluence_url }} - run: | - # Get current issue body - CURRENT_BODY=$(curl -s "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github+json" | jq -r '.body') - - # Add Confluence link to the end - UPDATED_BODY=$(jq -n \ - --arg current "$CURRENT_BODY" \ - --arg confluence "$CONFLUENCE_URL" \ - '$current + "\n\n📄 **Requirements documented:** " + $confluence') - - # Update issue with Confluence link - PAYLOAD=$(jq -n \ - --arg body "$UPDATED_BODY" \ - '{body: $body}') - - curl -X PATCH "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github+json" \ - -H "Content-Type: application/json" \ - -d "$PAYLOAD" - - echo "✅ Added Confluence link to issue" - - update-github-issue: - runs-on: ubuntu-latest - needs: preprocess - if: needs.preprocess.outcome == 'success' - permissions: - contents: read - issues: write - steps: - - name: Update GitHub issue with enhanced description - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_NUMBER: ${{ github.event.issue.number }} - - run: | + set -e # Exit on error + + # Ensure jq is available + if ! command -v jq &> /dev/null; then + echo "⚠️ jq not found, installing..." + sudo apt-get update && sudo apt-get install -y jq + fi + # Read enhanced task from JSON output to avoid shell quoting issues TASK_JSON="${{ needs.preprocess.outputs.task_json }}" if [ -n "$TASK_JSON" ] && [ "$TASK_JSON" != "null" ]; then From 6e113fdccdb6e6a85f007bdc97a6ad494de2099d Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 15:05:57 +0100 Subject: [PATCH 5/7] Fix update-github-issue step: add error handling and jq check - Add 'if: needs.preprocess.outcome == success' condition - Add set -e at start of run section for error handling - Add jq availability check (should be pre-installed in ubuntu-latest) - Fixes exit code 127 error in workflow run --- .github/workflows/feature-request-enhance.yml | 189 +++++++++++++++++- 1 file changed, 181 insertions(+), 8 deletions(-) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index f1c5e0b..498fd21 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -14,14 +14,187 @@ jobs: - name: Check if issue has enhancement label id: check run: | - set -e # Exit on error - - # Ensure jq is available - if ! command -v jq &> /dev/null; then - echo "⚠️ jq not found, installing..." - sudo apt-get update && sudo apt-get install -y jq - fi - + # For 'labeled' events, check if the label being added is 'enhancement' + # For 'opened' events, check if issue has 'enhancement' label + if [ "${{ github.event.action }}" = "labeled" ]; then + if [ "${{ github.event.label.name }}" = "enhancement" ]; then + echo "has_enhancement=true" >> $GITHUB_OUTPUT + else + echo "has_enhancement=false" >> $GITHUB_OUTPUT + fi + else + # For 'opened' events, check all labels + LABELS="${{ join(github.event.issue.labels.*.name, ',') }}" + if echo "$LABELS" | grep -q "enhancement"; then + echo "has_enhancement=true" >> $GITHUB_OUTPUT + else + echo "has_enhancement=false" >> $GITHUB_OUTPUT + fi + - name: Check if issue already enhanced + id: check-enhanced + run: | + # Check if issue already has enhanced content + ISSUE_BODY="${{ github.event.issue.body }}" + if echo "$ISSUE_BODY" | grep -q "Enhanced Feature Request"; then + echo "already_enhanced=true" >> $GITHUB_OUTPUT + echo "Issue already has enhanced content, skipping" + else + echo "already_enhanced=false" >> $GITHUB_OUTPUT + + preprocess: + runs-on: ubuntu-latest + needs: check-label + if: needs.check-label.outputs.has_enhancement == 'true' && needs.check-label.outputs.already_enhanced == 'false' + permissions: + contents: read + outputs: + enhanced_task: ${{ steps.preprocess.outputs.enhanced_task }} + task_json: ${{ steps.preprocess.outputs.task_json }} + steps: + - name: Checkout develop + uses: actions/checkout@v4 + with: + ref: develop + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install agent dependencies + working-directory: .github/agent + run: npm install + + - name: Preprocess feature request to user story (OpenAI only) + id: preprocess + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + PREPROCESSING_MODEL: ${{ secrets.PREPROCESSING_MODEL }} + TASK: ${{ github.event.issue.title }} + REQUESTER: ${{ github.event.issue.user.login }} + # Skip Confluence creation in preprocessing - will be done in parallel job + CONFLUENCE_URL: "" + CONFLUENCE_EMAIL: "" + CONFLUENCE_API_TOKEN: "" + CONFLUENCE_SPACE_KEY: "" + CONFLUENCE_PARENT_PAGE_ID: "" + GITHUB_RUN_ID: ${{ github.run_id }} + run: | + OUTPUT=$(node .github/agent/preprocess-task.mjs 2>&1) + echo "$OUTPUT" + + # Extract enhanced task from output + if echo "$OUTPUT" | grep -q "ENHANCED_TASK_START"; then + ENHANCED_TASK=$(echo "$OUTPUT" | sed -n '/ENHANCED_TASK_START/,/ENHANCED_TASK_END/p' | sed '1d;$d') + echo "enhanced_task<> $GITHUB_OUTPUT + echo "$ENHANCED_TASK" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + else + # Fallback to original task + echo "enhanced_task=${{ github.event.issue.title }}" >> $GITHUB_OUTPUT + + # Extract JSON if available + JSON_LINE=$(echo "$OUTPUT" | grep "ENHANCED_TASK_JSON:" || true) + if [ -n "$JSON_LINE" ]; then + JSON_DATA=$(echo "$JSON_LINE" | sed 's/ENHANCED_TASK_JSON://') + echo "task_json=$JSON_DATA" >> $GITHUB_OUTPUT + else + echo "task_json=null" >> $GITHUB_OUTPUT + + create-confluence: + runs-on: ubuntu-latest + needs: preprocess + permissions: + contents: read + issues: write + outputs: + confluence_url: ${{ steps.confluence.outputs.confluence_url }} + steps: + - name: Checkout develop + uses: actions/checkout@v4 + with: + ref: develop + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install agent dependencies + working-directory: .github/agent + run: npm install + + - name: Create Confluence page + id: confluence + env: + TASK: ${{ github.event.issue.title }} + REQUESTER: ${{ github.event.issue.user.login }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + CONFLUENCE_URL: ${{ secrets.CONFLUENCE_URL }} + CONFLUENCE_EMAIL: ${{ secrets.CONFLUENCE_EMAIL }} + CONFLUENCE_API_TOKEN: ${{ secrets.CONFLUENCE_API_TOKEN }} + CONFLUENCE_SPACE_KEY: ${{ secrets.CONFLUENCE_SPACE_KEY }} + CONFLUENCE_PARENT_PAGE_ID: ${{ secrets.CONFLUENCE_PARENT_PAGE_ID }} + GITHUB_RUN_ID: ${{ github.run_id }} + GITHUB_REPOSITORY: ${{ github.repository }} + ENHANCED_TASK: ${{ needs.preprocess.outputs.enhanced_task }} + run: | + OUTPUT=$(node .github/agent/create-confluence.mjs 2>&1) + echo "$OUTPUT" + + # Extract Confluence URL + CONFLUENCE_URL=$(echo "$OUTPUT" | grep "CONFLUENCE_URL:" | sed 's/CONFLUENCE_URL://' || echo "") + if [ -n "$CONFLUENCE_URL" ]; then + echo "confluence_url=$CONFLUENCE_URL" >> $GITHUB_OUTPUT + else + echo "confluence_url=" >> $GITHUB_OUTPUT + + - name: Add Confluence link to issue + if: steps.confluence.outputs.confluence_url != '' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CONFLUENCE_URL: ${{ steps.confluence.outputs.confluence_url }} + run: | + # Get current issue body + CURRENT_BODY=$(curl -s "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" | jq -r '.body') + + # Add Confluence link to the end + UPDATED_BODY=$(jq -n \ + --arg current "$CURRENT_BODY" \ + --arg confluence "$CONFLUENCE_URL" \ + '$current + "\n\n📄 **Requirements documented:** " + $confluence') + + # Update issue with Confluence link + PAYLOAD=$(jq -n \ + --arg body "$UPDATED_BODY" \ + '{body: $body}') + + curl -X PATCH "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD" + + echo "✅ Added Confluence link to issue" + + update-github-issue: + runs-on: ubuntu-latest + needs: preprocess + if: needs.preprocess.outcome == 'success' + permissions: + contents: read + issues: write + steps: + - name: Update GitHub issue with enhanced description + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + + run: | # Read enhanced task from JSON output to avoid shell quoting issues TASK_JSON="${{ needs.preprocess.outputs.task_json }}" if [ -n "$TASK_JSON" ] && [ "$TASK_JSON" != "null" ]; then From 248d304a3f8dc488e1e68a55999d35f6243103c3 Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 15:06:09 +0100 Subject: [PATCH 6/7] Add error handling to update-github-issue step - Add set -e at start of run section - Add jq availability check - Fixes exit code 127 error --- .github/workflows/feature-request-enhance.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index 498fd21..fdd826f 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -193,8 +193,15 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE_NUMBER: ${{ github.event.issue.number }} - run: | + set -e # Exit on error + + # Ensure jq is available (should be pre-installed in ubuntu-latest) + if ! command -v jq &> /dev/null; then + echo "⚠️ jq not found, installing..." + sudo apt-get update && sudo apt-get install -y jq + fi + # Read enhanced task from JSON output to avoid shell quoting issues TASK_JSON="${{ needs.preprocess.outputs.task_json }}" if [ -n "$TASK_JSON" ] && [ "$TASK_JSON" != "null" ]; then From 44d707d1d13b04cc48630acba368faa348efc79a Mon Sep 17 00:00:00 2001 From: htilly Date: Fri, 19 Dec 2025 15:07:45 +0100 Subject: [PATCH 7/7] Fix update-github-issue step: add error handling and jq check - Add 'if: needs.preprocess.outcome == success' condition - Add set -e at start of run section for error handling - Add jq availability check (should be pre-installed in ubuntu-latest) - Remove duplicate set -e and jq checks - Fix syntax errors (missing fi, indentation) - Fixes exit code 127 error in workflow run --- .github/workflows/feature-request-enhance.yml | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/feature-request-enhance.yml b/.github/workflows/feature-request-enhance.yml index fdd826f..12a47be 100644 --- a/.github/workflows/feature-request-enhance.yml +++ b/.github/workflows/feature-request-enhance.yml @@ -204,37 +204,23 @@ jobs: # Read enhanced task from JSON output to avoid shell quoting issues TASK_JSON="${{ needs.preprocess.outputs.task_json }}" + if [ -n "$TASK_JSON" ] && [ "$TASK_JSON" != "null" ]; then # Extract values from JSON using jq - set -e # Exit on error - - # Ensure jq is available - if ! command -v jq &> /dev/null; then - echo "⚠️ jq not found, installing..." - sudo apt-get update && sudo apt-get install -y jq - fi - - - set -e # Exit on error - - # Ensure jq is available (should be pre-installed in ubuntu-latest) - if ! command -v jq &> /dev/null; then - echo "⚠️ jq not found, installing..." - sudo apt-get update && sudo apt-get install -y jq - fi - - ENHANCED_TASK=$(echo "$TASK_JSON" | jq -r '.enhanced // empty') ORIGINAL_TASK=$(echo "$TASK_JSON" | jq -r '.original // empty') else # Fallback to outputs if JSON not available ENHANCED_TASK="${{ needs.preprocess.outputs.enhanced_task }}" ORIGINAL_TASK="${{ github.event.issue.title }}" + fi # Get original body (may be null/empty) ORIGINAL_BODY="${{ github.event.issue.body }}" if [ -z "$ORIGINAL_BODY" ] || [ "$ORIGINAL_BODY" = "null" ]; then ORIGINAL_BODY="_(No description provided)_" + fi + # Build enhanced body with proper escaping using jq ENHANCED_BODY=$(jq -n \ --arg enhanced "$ENHANCED_TASK" \