mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-09 10:15:26 +00:00
Add pull request preview actions
This commit is contained in:
36
.github/workflows/preview_cleanup.yml
vendored
Normal file
36
.github/workflows/preview_cleanup.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Clean Preview
|
||||||
|
|
||||||
|
#! Safety:
|
||||||
|
#! this workflow should not execute any code at all
|
||||||
|
#! see githubs docs on pull_request_target for more
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [unlabeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clean:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event.label.name == 'use-preview'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: build-previews
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: clean previews
|
||||||
|
run: 'rm -rf "./refs/pull/${{ github.event.pull_request.number }}"'
|
||||||
|
|
||||||
|
- name: publish cleaned previews
|
||||||
|
uses: JamesIves/github-pages-deploy-action@4.1.5
|
||||||
|
with:
|
||||||
|
folder: .
|
||||||
|
branch: build-previews
|
||||||
|
|
||||||
|
- name: send comment
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
with:
|
||||||
|
header: Preview environment
|
||||||
|
message: |
|
||||||
|
## Preview environment
|
||||||
|
There is no longer a preview enviroment for this pull request due to the `use-preview` label being removed
|
||||||
47
.github/workflows/preview_pull_request.yml
vendored
Normal file
47
.github/workflows/preview_pull_request.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: Preview Pull Request
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [synchronize, reopened, labeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# make sure the pull request is labeled with 'use-preview'
|
||||||
|
if: github.event.label.name == 'use-preview' || contains(github.event.pull_request.labels.*.name, 'use-preview')
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
# Head commit of the pull request
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 15
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn check
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: publish preview
|
||||||
|
uses: JamesIves/github-pages-deploy-action@4.1.5
|
||||||
|
with:
|
||||||
|
branch: build-previews
|
||||||
|
folder: dist
|
||||||
|
target-folder: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: send comment
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
with:
|
||||||
|
header: Preview environment
|
||||||
|
message: |
|
||||||
|
## Preview environment
|
||||||
|
https://${{ github.repository_owner }}.github.io/revite/${{ github.ref }}/index.html
|
||||||
|
|
||||||
|
This link will remain active until the `use-preview` label is removed.
|
||||||
Reference in New Issue
Block a user