This repository has been archived by the owner on May 24, 2024. It is now read-only.
Add package-lock json #190
Workflow file for this run
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: delete preview on PR close | |
# only trigger on pull request closed events | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
delete_preview: | |
runs-on: ubuntu-latest | |
env: | |
PR_PATH: pull/${{github.event.number}} | |
ENVIRONMENT_NAME: preview-pr-${{ github.event.number }} | |
steps: | |
- name: make empty dir | |
run: mkdir public | |
- name: delete folder | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
destination_dir: ${{ env.PR_PATH }} | |
- name: get deployment | |
id: get-deplpoyment | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/{repository}/deployments | |
repository: ${{ github.repository }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
- name: set previous deployment as inactive | |
if: | | |
steps.get-deplpoyment.outputs.status != '404' && | |
toJSON(fromJSON(steps.get-deplpoyment.outputs.data)) != '[]' | |
uses: octokit/[email protected] | |
with: | |
route: POST /repos/{repository}/deployments/{deployment}/statuses | |
deployment: ${{ fromJSON(steps.get-deplpoyment.outputs.data)[0].id }} | |
repository: ${{ github.repository }} | |
state: inactive | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |