-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 1.95 KB
/
code-gen.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: "Update Graphql API"
on:
schedule:
- cron: "0 0 * * 3"
workflow_call:
workflow_dispatch:
jobs:
update-graphql-api:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=${{ env.golang-version }}"
cache: false
- name: Generate Graphql Schema
run: |
MONDOO_API_TOKEN=${{ secrets.MONDOO_API_TOKEN }} make generate
- name: Prepare title and branch name
id: branch
run: |
BRANCH_NAME="schema/update_$(date +'%Y%m%d%H%M%S')"
COMMIT_MSG="🧹 Bump GraphQL Schema - $(date +'%Y%m%d%H%M%S')"
echo "COMMIT_TITLE=${COMMIT_MSG}" >> $GITHUB_OUTPUT
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
- name: Check git diff
id: git-diff
run: |
DIFF=$(git status --porcelain | wc -l)
echo "GIT_DIFF=${DIFF}" >> $GITHUB_OUTPUT
- name: Create PR
if: steps.git-diff.outputs.GIT_DIFF != '0'
id: cpr
uses: peter-evans/create-pull-request@v7
with:
base: main
labels: dependencies,go
committer: "Mondoo Tools <[email protected]>"
commit-message: ${{ steps.branch.outputs.COMMIT_TITLE }}
author: "Mondoo Tools <[email protected]>"
title: ${{ steps.branch.outputs.COMMIT_TITLE }}
branch: ${{ steps.branch.outputs.BRANCH_NAME }}
body-path: .github/pr-body.md
- name: PR infos
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"