Skip to content

Add stats comment to Pull Requests #54

Add stats comment to Pull Requests

Add stats comment to Pull Requests #54

Workflow file for this run

name: Stats comment
on:
pull_request:
workflow_dispatch:
permissions:
pull-requests: write
jobs:
generate-stats:
name: Generate stats
runs-on: ubuntu-latest
# Skip when token write permissions are unavailable on forks
if: ${{ !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 = {
titleText: ':clipboard: Stats',
markerText: 'stats'
}
await commentStats({ github, context, commit }, issueNumber, options)