forked from cloudquery/cloudquery
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.94 KB
/
manual_commands_triggers.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
name: Manual Commands Triggers
on:
repository_dispatch:
types: [gen-command]
jobs:
ok-to-run:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
status: ${{ steps.manually_approved.outputs.result }}
steps:
- name: Check if was manually approved
id: manually_approved
run: |
manually_approved=${{ github.event_name == 'repository_dispatch' && github.event.client_payload.slash_command.args.named.sha != '' && contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.args.named.sha) }}
echo "result=${manually_approved}" >> $GITHUB_OUTPUT
gen:
timeout-minutes: 30
needs: [ok-to-run]
if: github.event_name == 'repository_dispatch' && github.event.action == 'gen-command' && needs.ok-to-run.outputs.status == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.slash_command.args.named.sha }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
token: ${{ secrets.GH_CQ_BOT }}
- name: Setup CloudQuery
uses: cloudquery/setup-cloudquery@v3
with:
version: 'v3.13.0'
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version-file: plugins/source/${{ github.event.client_payload.slash_command.args.named.plugin }}/go.mod
cache: true
cache-dependency-path: plugins/source/${{ github.event.client_payload.slash_command.args.named.plugin }}/go.sum
- name: Generate code
run: make gen
working-directory: plugins/source/${{ github.event.client_payload.slash_command.args.named.plugin }}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: Update code and docs"
branch: ${{ github.event.client_payload.pull_request.head.ref }}