Skip to content

Stats comment

Stats comment #77

Workflow file for this run

name: Stats comment
on:
workflow_call:
workflow_dispatch:
jobs:
generate-stats:
name: Generate stats
runs-on: ubuntu-latest
# Skip workflows other than PRs such as merges to `main` but
# also when token write permissions are unavailable on forks
if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3
- name: Restore dependencies
uses: ./.github/workflows/actions/install-node
- name: Build
uses: ./.github/workflows/actions/build
- name: Add comment to PR
uses: actions/github-script@v6.4.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { commentStats } = await import('${{ github.workspace }}/.github/workflows/scripts/comments.mjs')
// PR information
const issueNumber = ${{ github.event.pull_request.number }}
const commit = '${{ github.event.pull_request.head.sha }}'
const options = {
path: '${{ github.workspace }}',
titleText: ':clipboard: Stats',
markerText: 'stats'
}
await commentStats({ github, context, commit }, issueNumber, options)