Skip to content

Commit

Permalink
action: update specs (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Feb 8, 2023
1 parent 3aa6f6b commit 260992b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .ci/update-specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: update specs

scms:
githubConfig:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: elastic
repository: ecs-logging-java
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: main

actions:
ecs-logging-java:
kind: github/pullrequest
scmid: githubConfig
sourceid: sha
spec:
automerge: false
labels:
- dependencies
title: 'synchronize ecs-logging spec'
description: |-
### What
ECS logging specs automatic sync
### Why
*Changeset*
* https://github.com/elastic/ecs-logging/commit/{{ source "sha" }}
sources:
spec.json:
name: Get specs from json
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/ecs-logging/main/spec/spec.json

sha:
name: Get commit
kind: json
spec:
file: 'https://api.github.com/repos/elastic/ecs-logging/commits?path=spec%2Fspec.json&page=1&per_page=1'
key: ".[0].sha"

targets:
spec.json-update:
name: 'synchronize ecs-logging spec'
kind: file
sourceid: spec.json
scmid: githubConfig
spec:
file: ecs-logging-core/src/test/resources/spec/spec.json
1 change: 1 addition & 0 deletions .github/workflows/opentelemetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
workflows:
- test
- test-reporter
- update-specs
types: [completed]

jobs:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/update-specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Send PRs to the subscribed ECS Agents if the spec files (JSON) are modified
name: update-specs

on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'

permissions:
pull-requests: write
contents: write

jobs:
bump:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

- name: Setup Git
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current

- name: Install Updatecli in the runner
uses: updatecli/updatecli-action@453502948b442d7b9a923de7b40cc7ce8628505c

- name: Run Updatecli
env:
GITHUB_TOKEN: ${{ github.token }}
run: updatecli apply --config ./.ci/update-specs.yml

0 comments on commit 260992b

Please sign in to comment.