-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.65 KB
/
on-sync.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
name: On sync
on:
push:
branches: ["main"]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
result: ${{ steps.script.outputs.result }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get changed files
id: changes
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366 # v45.0.5
with:
files_yaml: |
workflows: [.github/workflows/**/*]
bird: [bird/**/*]
otelcol: [otelcol/**/*]
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: script
env:
changes: ${{ toJSON(steps.changes.outputs)}}
with:
script: |
const { changed_keys = "" } = JSON.parse(process.env.changes)
return {
build: {
otelcol: changed_keys.includes("workflows") || changed_keys.includes("otelcol"),
bird: changed_keys.includes("workflows") || changed_keys.includes("bird"),
},
}
build-otelcol:
needs: [prepare]
if: ${{ fromJSON(needs.prepare.outputs.result).build.otelcol }}
uses: ./.github/workflows/wf-build-otelcol.yaml
with:
push: true
build-bird:
needs: [prepare]
if: ${{ fromJSON(needs.prepare.outputs.result).build.bird }}
uses: ./.github/workflows/wf-build-bird.yaml
with:
push: ${{ fromJSON(needs.prepare.outputs.push) }}