-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (40 loc) · 1.36 KB
/
staging.yaml
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
name: Staging
on:
issue_comment:
types: [created]
jobs:
pr_commented:
name: Staging PR comment
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, '/staging')
steps:
- uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ github.event.comment.id }}
reactions: "rocket"
# needed to be able to check out correct branch
- uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
# Extract database name from staging comment
- name: comment-slugs
id: comment_slugs
if: startsWith(github.event.comment.body, '/staging')
shell: bash
run: |
COMMENT="${{ github.event.comment.body }}"
DB_NAME=$(echo "$COMMENT" | sed "s/\/staging //g")
if [[ "$DB_NAME" != "/staging" ]]
then echo "$DB_NAME" > db_name.txt;
else echo "Missing db name" && exit 1; fi
- uses: Amwam/[email protected]
with:
keywords: '["/staging"]'
labels: '["staging"]'
github-token: "${{ secrets.ACTIONS_PAT }}"
- name: Upload artifact with db name
uses: actions/upload-artifact@v2
with:
name: db_name-${{ steps.comment-branch.outputs.head_ref }}
path: db_name.txt