chore: semantic report for each pr #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: PR Health Checks π | |
on: | |
pull_request: | |
branches: | |
- master | |
permissions: write-all | |
jobs: | |
PR-checks: | |
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/using-self-hosted-runners-in-a-workflow | |
runs-on: ubuntu-latest | |
name: PR Health Checks π | |
steps: | |
- name: π Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: π§ͺ Check out repository code | |
uses: ./.github/workflows/health-check | |
- name: π¬ Check semantic versioning | |
id: semantic-release | |
run: | | |
GITHUB_REF=${{ github.head_ref }} | |
npx semantic-release --no-ci --dry-run --plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator --branches ${{ github.head_ref }} > output.txt | |
OUTPUT=$(cat output.txt | base64 -w 0) | |
echo "::set-output name=releaseNote::$OUTPUT" | |
- name: π Report semantic versioning | |
uses: actions/github-script@v3 | |
if: ${{ steps.semantic-release.outputs.releaseNote != '' }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
let fromBuffer = Buffer.from('${{ steps.semantic-release.outputs.releaseNote }}', 'base64').toString('utf8'); | |
let releaseNote = fromBuffer.split('\n').filter((line) => !line.match(/^[[0-9:\sAMPM]+\]\s\[semantic-release\].*$/)); | |
if (!releaseNote.length) { | |
return; | |
} | |
let res = releaseNote.join('\n'); | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `The new semantic report is: \n ${res}`, | |
}) |