ci: cleanup jenkins leftovers #2
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: Validate 👌 | |
on: | |
pull_request: | |
jobs: | |
preview: | |
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=$(npx semantic-release --dry-run)" >> $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]'); | |
const message = `${{ steps.changelog.outputs.changelog }}`; | |
if (botComment) { | |
await github.rest.issues.updateComment({ | |
...context.repo, | |
comment_id: botComment.id, | |
body: message | |
}); | |
} else { | |
await github.rest.issues.createComment({ | |
...context.repo, | |
issue_number, | |
body: message | |
}); | |
} |