-
Notifications
You must be signed in to change notification settings - Fork 100
37 lines (34 loc) · 1.1 KB
/
rdme-delete-staging.yml
File metadata and controls
37 lines (34 loc) · 1.1 KB
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
name: Delete ReadMe Staging
on:
pull_request:
types:
- closed
paths:
- 'reference/**'
- 'openapi/**'
- '.github/actions/**'
- '.github/workflows/rdme-staging.yml'
jobs:
delete-staging:
if: ${{ github.event.pull_request.head.repo.full_name == 'mixpanel/docs' }}
runs-on: ubuntu-latest
steps:
- name: Check out repo 📚
uses: actions/checkout@v4
- uses: actions/setup-node@v5
with:
node-version: 20
cache: 'npm'
- run: npm ci
- name: Add node_modules to PATH
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
- name: Delete staging version
run: |
status=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE "https://api.readme.com/v2/branches/3.27-pr-${{ github.event.number }}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.README_API_KEY }}")
if [ "$status" -eq 204 ]; then
echo "Version deleted successfully"
else
echo "Version doesn't exist, no need to delete"
fi