Skip to content

JSDoc Analysis Comment #4169

JSDoc Analysis Comment

JSDoc Analysis Comment #4169

name: JSDoc Analysis Comment
on:
workflow_run:
workflows: ["Check"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
comment:
name: JSDoc Analysis
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: write
timeout-minutes: 1
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Get JSDoc stats
id: stats
run: |
{
echo 'stats<<EOF'
cat jsdoc-stats/jsdoc-stats.md
echo EOF
} >> $GITHUB_OUTPUT
# https://github.com/orgs/community/discussions/25220#discussioncomment-11300118
- name: Get PR number
id: pr-context
env:
GH_TOKEN: ${{ github.token }}
PR_TARGET_REPO: ${{ github.repository }}
PR_BRANCH: |-
${{
(github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login)
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
|| github.event.workflow_run.head_branch
}}
run: gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" --json 'number' --jq '"number=\(.number)"' >> "${GITHUB_OUTPUT}"
- name: Find Comment
id: find-comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ steps.pr-context.outputs.number }}
comment-author: "github-actions[bot]"
body-includes: <!-- JSDoc Analysis PR Report -->
- name: Create Comment
id: comment
uses: peter-evans/create-or-update-comment@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JSDOC_STATS: "${{ steps.stats.outputs.stats }}"
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ steps.pr-context.outputs.number }}
edit-mode: replace
body: |
<!-- JSDoc Analysis PR Report -->
## 📊 JSDoc Documentation Analysis
<details>
<summary>📈 Current Analysis Results</summary>
${{ env.JSDOC_STATS }}
</details>
---
*This comment is automatically updated on each push. View the [analysis script](https://github.com/Effect-TS/effect-smol/blob/main/scripts/analyze-jsdoc.mjs) for details.*