Skip to content

chore: update dependencies #119

chore: update dependencies

chore: update dependencies #119

Workflow file for this run

name: PR Comment
on:
pull_request:
types: [opened, synchronize]
jobs:
pr-comment:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/github-script@v7
with:
script: |
const sbImage = `https://developer.stackblitz.com/img/open_in_stackblitz.svg`;
const sbPath = `${{ github.repository }}/tree/${{ github.head_ref }}`;
const newComment = `
<!-- ${{ github.workflow }} -->
[![Open in StackBlitz](${sbImage})](https://stackblitz.com/fork/github/${sbPath})
[▶️ Run example](https://${context.repo.owner}.github.io/${context.repo.repo}/${{ github.head_ref }}/)
`;
github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
}).then(comments => {
const comment = comments.data.find(comment => (
comment.user.login === 'github-actions[bot]'
&& comment.body.includes(`<!-- ${{ github.workflow }} -->`)
))
if (comment) {
if (comment.body === newComment) {
return
}
github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: newComment
})
} else {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: newComment
})
}
})