Skip to content

Commit 98efc9d

Browse files
committed
Add daily semconv check
1 parent d4994c1 commit 98efc9d

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

.github/workflows/build-dev.yml

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
description: Regex of submodule paths to update to HEAD before building.
88
default: content-modules
99
type: string
10+
workflow_call:
11+
inputs:
12+
submodule_path_regex:
13+
type: string
14+
required: true
1015

1116
jobs:
1217
build-and-test:
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build Semantic Conventions (daily)
2+
3+
on:
4+
schedule:
5+
# daily at 10:24 UTC
6+
- cron: "24 10 * * *"
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-dev:
11+
uses: ./.github/workflows/build-dev.yml
12+
with:
13+
submodule_path_regex: semantic-conventions
14+
15+
workflow-notification:
16+
needs:
17+
- build-dev
18+
if: always()
19+
uses: ./.github/workflows/reusable-workflow-notification.yml
20+
with:
21+
success: ${{ needs.build-dev.result == 'success' }}
22+
repo: open-telemetry/semantic-conventions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# this is useful because notifications for scheduled workflows are only sent to the user who
2+
# initially created the given workflow
3+
name: Reusable - Workflow notification
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
success:
9+
type: boolean
10+
required: true
11+
repo:
12+
type: string
13+
required: false
14+
15+
jobs:
16+
workflow-notification:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Open issue or add comment if issue already open
22+
env:
23+
# need to use opentelemetrybot for opening issues in other repos
24+
GH_TOKEN: ${{ inputs.repo && secrets.OPENTELEMETRYBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
25+
run: |
26+
if [ -z "${{ inputs.repo }}" ]; then
27+
repo="$GITHUB_REPOSITORY"
28+
title="Workflow failed: $GITHUB_WORKFLOW"
29+
body="See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
30+
else
31+
repo="${{ inputs.repo }}"
32+
title="Workflow failed: $GITHUB_REPOSITORY $GITHUB_WORKFLOW"
33+
body="See [$GITHUB_REPOSITORY $GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
34+
fi
35+
36+
# TODO (trask) search doesn't support exact phrases, so it's possible that this could grab the wrong issue
37+
number=$(gh issue list --repo $repo --search "in:title $title" --limit 1 --json number -q .[].number)
38+
39+
echo $number
40+
echo ${{ inputs.success }}
41+
42+
if [[ $number ]]; then
43+
if [[ "${{ inputs.success }}" == "true" ]]; then
44+
gh issue close $number \
45+
--repo $repo
46+
else
47+
gh issue comment $number \
48+
--repo $repo \
49+
--body "$body"
50+
fi
51+
elif [[ "${{ inputs.success }}" == "false" ]]; then
52+
gh issue create --repo $repo \
53+
--title "$title (#$GITHUB_RUN_NUMBER)" \
54+
--body "$body"
55+
fi

0 commit comments

Comments
 (0)