forked from aragon/gov-ui-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 1.57 KB
/
storybook-preview-remove.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Storybook Preview Remove
on:
pull_request:
types:
- unlabeled
- closed
env:
NODE_VERSION: 16
NODE_CACHE: "yarn"
jobs:
remove-preview:
if: contains(github.event.pull_request.labels.*.name, 'preview') || github.event.label.name == 'preview'
runs-on: ubuntu-latest
steps:
- name: Install pyyaml
run: pip install --user pyyaml packaging
- name: Install ipfs-cluster-ctl
run: |
wget https://dist.ipfs.io/ipfs-cluster-ctl/v1.0.0/ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz
tar xvfz ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz
- name: Get deployment
uses: peter-evans/[email protected]
id: get-deployment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: "Storybook IPFS Hash: "
- name: Unpin from IPFS
if: steps.get-deployment.outputs.comment-id != 0
run: |
COMMENT='${{ steps.get-deployment.outputs.comment-body }}'
IFS=" " read -ra array <<< "$COMMENT"
hash=${array[3]}
./ipfs-cluster-ctl/ipfs-cluster-ctl --basic-auth '${{ secrets.IPFS_BASIC_AUTH }}' --host '${{ secrets.IPFS_HOST }}' pin rm $hash
- name: Delete Comment
uses: actions/[email protected]
if: steps.get-deployment.outputs.comment-id != 0
with:
script: |
github.rest.issues.deleteComment({
comment_id: ${{ steps.get-deployment.outputs.comment-id }},
owner: context.repo.owner,
repo: context.repo.repo,
})