Skip to content

Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1 #129

Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1

Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1 #129

Workflow file for this run

#
# Build and preview documentation in PRs
# DOES NOT WORK FOR FORKS.
name: Preview PR
on:
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout
uses: actions/checkout@v4
- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: 0.97.3
extended: true
- name: Change Hugo baseurl so that PR preview works
run: |
sed -i 's#https://gmt-china.org/#https://gmt-china.github.io/sitepreview/gmt-china/gmt-china.org/${{ github.head_ref }}/#' config/_default/config.yaml
rm static/CNAME
- name: Build the website
run: make build
- name: Deploy for preview
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847
with:
# personal token can be generated at https://github.com/settings/tokens,
# and added to https://github.com/organizations/gmt-china/settings/secrets/actions
personal_token: ${{ secrets.TOKEN_DOCUMENT_DEPLOY }}
publish_dir: ./public
destination_dir: ${{ github.repository }}/${{ github.head_ref }}
external_repository: gmt-china/sitepreview
keep_files: false
allow_empty_commit: true
force_orphan: false
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This comment was written by the Continuous Documentation bot!
if: github.event.pull_request.head.repo.full_name == github.repository
- name: Create comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
This comment was written by the Continuous Documentation bot!
- **Preview**: https://gmt-china.github.io/sitepreview/${{ github.repository }}/${{ github.head_ref }}/index.html
- **Commit hash**: ${{ github.event.pull_request.head.sha }}
if: github.event.pull_request.head.repo.full_name == github.repository && steps.fc.outputs.comment-id == 0
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
This comment was written by the Continuous Documentation bot!
- **Preview**: https://gmt-china.github.io/sitepreview/${{ github.repository }}/${{ github.head_ref }}/index.html
- **Commit hash**: ${{ github.event.pull_request.head.sha }}
if: github.event.pull_request.head.repo.full_name == github.repository && steps.fc.outputs.comment-id != 0