-
Notifications
You must be signed in to change notification settings - Fork 35
130 lines (127 loc) · 4.49 KB
/
slash-commands.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Slash Command CI
on:
issue_comment:
types: [created]
jobs:
format_command:
runs-on: ubuntu-latest
name: Execute "/format" slash command
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/format')
env:
SLASH_COMMAND: format
steps:
- name: Parse Slash Command
id: command
uses: xt0rted/slash-command-action@v1
with:
permission-level: admin
reaction-type: eyes
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: ${{ env.SLASH_COMMAND }}
- name: Echo command (debug)
run: echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'"
- name: Clone git repo
uses: actions/checkout@v2
- name: Checkout Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_URL="${{ github.event.issue.pull_request.url }}"
PR_NUM=${PR_URL##*/}
echo "Checking out from PR #$PR_NUM based on URL: $PR_URL"
hub pr checkout $PR_NUM
git config --global user.email "[email protected]"
git config --global user.name "AJ Steers (CI bot)"
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.2
- name: Run Terraform auto-format
run: terraform fmt -recursive
- name: Commit and Push
run: |
git commit -a -m "GitOps Bot (Autoformat)"
git push
- name: Post success reaction
uses: xt0rted/slash-command-action@v1
with:
permission-level: admin
reaction-type: rocket
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: ${{ env.SLASH_COMMAND }}
- name: Post failure reaction
if: ${{ failure() }}
uses: xt0rted/slash-command-action@v1
with:
permission-level: admin
reaction-type: confused
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: ${{ env.SLASH_COMMAND }}
update_docs_command:
runs-on: ubuntu-latest
name: Execute "/docs" slash command
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/docs')
env:
SLASH_COMMAND: docs
steps:
- name: Parse Slash Command
id: command
uses: xt0rted/slash-command-action@v1
with:
permission-level: admin
reaction-type: eyes
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: ${{ env.SLASH_COMMAND }}
- name: Echo command (debug)
run: echo "The command was '${{ steps.command.outputs.command-name }}' with arguments '${{ steps.command.outputs.command-arguments }}'"
- name: Clone git repo
uses: actions/checkout@v2
- name: Checkout Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_URL="${{ github.event.issue.pull_request.url }}"
PR_NUM=${PR_URL##*/}
echo "Checking out from PR #$PR_NUM based on URL: $PR_URL"
hub pr checkout $PR_NUM
git config --global user.email "[email protected]"
git config --global user.name "AJ Steers (CI bot)"
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.2
- name: Install Go
uses: actions/setup-go@v2
- name: Install terraform-docs
run: |
GO111MODULE="on" go get github.com/terraform-docs/[email protected]
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: "x64"
- name: Install Python Libraries
run: |
pip install logless runnow uio
- name: Rebuild docs
run: |
export PATH=$PATH:$(go env GOPATH)/bin
cd autodocs
python build.py
- name: Commit and Push
run: |
git commit -a -m "GitOps Bot (Autodocs)"
git push
- name: Post success reaction
uses: xt0rted/slash-command-action@v1
with:
permission-level: admin
reaction-type: rocket
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: ${{ env.SLASH_COMMAND }}
- name: Post failure reaction
if: ${{ failure() }}
uses: xt0rted/slash-command-action@v1
with:
permission-level: admin
reaction-type: confused
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: ${{ env.SLASH_COMMAND }}