Skip to content

Commit

Permalink
Update url_check.yml
Browse files Browse the repository at this point in the history
Further corrections for json output handling
  • Loading branch information
cordt-sei authored Aug 8, 2024
1 parent 9661495 commit 90fa268
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/url_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ jobs:
id: process_results
run: |
output='${{ steps.run_checker.outputs.checker_output }}'
echo "Raw output:"
echo "$output"
total_issues=$(echo "$output" | jq -r '.total_issues')
echo "total_issues=$total_issues" >> $GITHUB_OUTPUT
- name: Create Issue with Results
if: ${{ steps.process_results.outputs.total_issues > 0 }}
if: ${{ fromJson(steps.process_results.outputs.total_issues) > 0 }}
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const output = JSON.parse('${{ steps.run_checker.outputs.checker_output }}');
const issueTitle = `🚨 Broken URLs Detected: ${output.total_issues} issues found`;
const issueTitle = `🚨 Broken URLs: ${output.total_issues} issues found`;
let issueBody = `## URL Check Results\n\n`;
issueBody += `### Issues Found: ${output.total_issues}\n\n`;
issueBody += "| File | Line | URL | Status Code | Reason |\n";
Expand All @@ -55,7 +57,7 @@ jobs:
issueBody += `| ${issue.file} | ${issue.line} | ${issue.url} | ${issue.status_code} | ${issue.reason} |\n`;
});
issueBody += "\n\nPlease review and fix these broken URLs.";
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.name,
Expand Down

0 comments on commit 90fa268

Please sign in to comment.