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 --base "/revite/${{ github.ref }}/" - 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.