-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.67 KB
/
generate.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
# This is a hack to update the code when new ECS tags are pushed.
name: generate
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- 'main'
workflow_dispatch:
jobs:
ecs-generate:
permissions:
# Allow job to write to a branch and open a PR.
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21
cache-dependency-path: ./internal/generator/go.sum
- name: generate
working-directory: ./internal/generator
run: go run .
- name: check for modified versions
id: is-changed
run: echo "modified=$(if git status --porcelain | grep -q -E 'internal/version'; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
- name: get elastic/ecs version
id: ecs-version
run: echo "version=$(cd ~/.ecs-generator/git/ecs; git describe --tags)" >> $GITHUB_OUTPUT
- name: Create PR
if: steps.is-changed.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v5
with:
commit-message: |
ecs@${{ steps.ecs-version.outputs.version }} update
Update code based on https://github.com/elastic/ecs/releases/tag/${{ steps.ecs-version.outputs.version }}
title: ecs@${{ steps.ecs-version.outputs.version }} update
body: Update code based on https://github.com/elastic/ecs/releases/tag/${{ steps.ecs-version.outputs.version }}
base: main
labels: automation
branch: ecs-update/${{ steps.ecs-version.outputs.version }}
delete-branch: true