Skip to content

Add a note to the archived article #709

Add a note to the archived article

Add a note to the archived article #709

# File: {your-blog-repo}/.github/workflows/pull-request-target.yml
name: pull-request-target
on:
pull_request_target:
types: [opened, reopened, edited, closed] # added edited type.
jobs:
pr-comment:
runs-on: ubuntu-latest
if:
github.event_name == 'pull_request_target' &&
(github.event.action == 'opened' || github.event.action == 'reopened')
steps:
- name: pr-comment
uses: cssjpn/blog-gh-actions/pr-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# If you want to deploy preview site automatically
deploy-preview-if-pr-owner-is-linked-account:
runs-on: ubuntu-latest
if:
github.event_name == 'pull_request_target' &&
(github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'edited')
steps:
- name: check linked account
# skip checking if pr is created by repository owner
if: github.event.pull_request.head.repo.owner.login != github.event.repository.owner.login
id: check_linked_account
uses: cssjpn/blog-gh-actions/check-linked-account@v1
with:
token: ${{ secrets.JPCSSBLOG_DEV_TOKEN }}
allowExternalUser: 'allow'
# Checks-out after passed the check
- uses: actions/checkout@v2
if:
steps.check_linked_account.outputs.isLinked == 'true' ||
github.event.pull_request.head.repo.owner.login == github.event.repository.owner.login
with:
ref: 'refs/pull/${{ github.event.number }}/merge'
submodules: true
- name: Deploy preview site
if:
steps.check_linked_account.outputs.isLinked == 'true' ||
github.event.pull_request.head.repo.owner.login == github.event.repository.owner.login
uses: cssjpn/blog-gh-actions/deploy-preview@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
azure-storage-connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
preview-base-url: "https://jpaztechblogpreview.z11.web.core.windows.net/" # need to update url.
branch-name: ${{ github.event.pull_request.head.label }}
pr-url: ${{ github.event.pull_request.html_url }}
repo-owner: ${{ github.event.repository.owner.login }}
repo-name: ${{ github.event.repository.name }}
delete-preview:
runs-on: ubuntu-latest
if:
github.event_name == 'pull_request_target' && github.event.action == 'closed'
steps:
- name: Delete preview site
uses: cssjpn/blog-gh-actions/delete-preview@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
azure-storage-connection-string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}