fix(autofix.ci): apply automated fixes #792
This file contains hidden or 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: 🪄 Deploy Preview | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request_target: | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| preview-comment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🪄 Add a comment | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }) | |
| const previewComment = comments.find(comment => { | |
| return comment.user.type === 'Bot' && comment.body.includes('# 🪄 Deploy Preview for ready!') | |
| }) | |
| const body = `# 🪄 Deploy Preview for ready! | |
| [](https://pr.new/${{ github.repository }}/pull/${{ github.event.pull_request.number }}) | |
| *Learn more about [StackBlitz Codeflow](https://stackblitz.com/codeflow/).* | |
| <!-- generated-comment [Preview](https://github.com/${{ github.repository }}/.github/workflows/preview.yml) -->` | |
| if (!previewComment) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }) | |
| } |