Add an article #912
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: pull-request-target | |
on: | |
pull_request_target: | |
types: [opened, reopened, edited, closed] | |
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' || github.event.action == 'synchronize') | |
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://jpazureidblogstorage.z5.web.core.windows.net/" | |
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 }} |