Skip to content

testing: changelog cleanup #10

testing: changelog cleanup

testing: changelog cleanup #10

Workflow file for this run

name: Validate 🚧
on:
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Unit tests
run: npm run test:unit
# - name: E2E tests
# run: npm run test
- name: Generate Changelog Preview
id: changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$(npx semantic-release --dry-run)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Comment PR
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue_number = context.issue.number;
const { data: comments } = await github.rest.issues.listComments({
...context.repo,
issue_number
});
const botComment = comments.find(comment => comment.user.login === 'github-actions[bot]');
if (botComment) {
await github.rest.issues.updateComment({
...context.repo,
comment_id: botComment.id,
body: `${{steps.changelog.outputs.changelog}}`
});
} else {
await github.rest.issues.createComment({
...context.repo,
issue_number,
body: `${{steps.changelog.outputs.changelog}}`
});
}