empty commit for staging test #4
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
# Remove preview from surge | |
# see `pull-request-preview.yml` for more context | |
name: Clean up pull request surge preview | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: get pull request ref | |
id: get_pull_request_ref | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/pulls/:issue_id | |
repository: ${{ github.repository }} | |
issue_id: ${{ github.event.number }} | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: list deployments | |
id: list_deployments | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/deployments | |
repository: ${{ github.repository }} | |
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }} | |
environment: dev | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: get deployment | |
id: get_deployment | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/deployments/:deployment | |
repository: ${{ github.repository }} | |
deployment: ${{ fromJson(steps.list_deployments.outputs.data)[0].id }} | |
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }} | |
environment: dev | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
# cleanup goes here | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: teardown from surge | |
run: npm run surge-teardown -- liputenpotest-${{ github.event.number }}.surge.sh | |
env: | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} # get with `surge token` | |
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} # email used | |
# we cannot delete the deployment as one must exist in the dev environment | |
# we could change its status but I will just leave it for now | |
# - name: delete deployment | |
# id: delete_deployment | |
# uses: octokit/[email protected] | |
# with: | |
# route: DELETE /repos/:repository/deployments/:deployment | |
# repository: ${{ github.repository }} | |
# deployment: ${{ fromJson(steps.list_deployments.outputs.data)[0].id }} | |
# env: | |
# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Send confirmation | |
id: send_confirmation | |
uses: octokit/[email protected] | |
with: | |
route: POST /repos/:repository/issues/:issue_id/comments | |
repository: ${{ github.repository }} | |
issue_id: ${{ github.event.number }} | |
body: "removed the deployment on liputenpotest-${{ github.event.number }}.surge.sh" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |