Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDevAU committed Nov 8, 2023
1 parent 3a7f7f6 commit 0356bb8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/validate-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,22 @@ jobs:
echo "${{ steps.lint_markdown.outputs.result }}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Show PR comment content
if: failure() && github.event.pull_request.head.repo.fork == false
run: cat pr_comment.md

# New Step 6: Comment on PR with linting errors if it's not from a fork
- name: Comment on PR
if: failure() && github.event.pull_request.head.repo.fork == false
run: |
# Convert linting results into a list, prefixing each line with markdown list syntax
LINT_ERRORS=$(echo "${{ steps.lint_markdown.outputs.result }}" | sed 's/^/- [ ] /')
LINT_ERRORS=$(echo "${{ steps.lint_markdown.outputs.result }}" | awk '{print "- [ ] " $0}')
# Use printf to handle newlines correctly
PR_COMMENT=$(printf "Hi @%s,\n\nThere were some Markdown Linting Errors in your pull request:\n%s\n\nPlease review the errors and update your Markdown files accordingly.\n" "${{ github.event.pull_request.user.login }}" "$LINT_ERRORS")
PR_COMMENT=$(printf "Hi @%s,\n\nThere were some Markdown Linting Errors in your pull request:\n\n%s\n\nPlease review the errors and update your Markdown files accordingly.\n" "${{ github.event.pull_request.user.login }}" "$LINT_ERRORS")
echo "$PR_COMMENT" > pr_comment.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}




- name: Upload PR Comment
if: failure() && github.event.pull_request.head.repo.fork == false
Expand Down

0 comments on commit 0356bb8

Please sign in to comment.