-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 1.92 KB
/
Copy pathsync.yml
File metadata and controls
68 lines (57 loc) · 1.92 KB
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
61
62
63
64
65
66
67
68
name: "Sync Upstream"
on:
workflow_dispatch:
schedule:
- cron: "20,50 * * * *"
permissions:
actions: write
contents: write
concurrency:
group: benchmark-opentelemetry-java-sync
cancel-in-progress: false
jobs:
sync:
name: Sync With Upstream
runs-on: ubuntu-24.04
steps:
- name: Checkout benchmark repo
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: false
token: ${{ github.token }}
- name: Sync upstream submodule
id: sync
run: |
set -euo pipefail
echo "updated=false" >> "$GITHUB_OUTPUT"
git config --global user.name "boringcache-bot"
git config --global user.email "boringcache-bot@users.noreply.github.com"
git submodule sync --recursive
git submodule update --init --remote --checkout upstream
github_repo_slug() {
local url="$1"
url="${url%/}"
url="${url#https://github.com/}"
url="${url#git@github.com:}"
url="${url#ssh://git@github.com/}"
url="${url%.git}"
url="${url%/}"
printf '%s' "$url"
}
upstream_url="$(cd upstream && git remote get-url origin)"
upstream_repo="$(github_repo_slug "$upstream_url")"
commit_sha="$(cd upstream && git rev-parse --short=7 HEAD)"
if git diff --quiet --submodule=short; then
echo "No upstream changes"
exit 0
fi
git add upstream
git commit -m "Update upstream to ${upstream_repo}@${commit_sha}"
git push origin HEAD:main
echo "updated=true" >> "$GITHUB_OUTPUT"
- name: Dispatch rolling benchmark
if: steps.sync.outputs.updated == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run opentelemetry-java-gradle-benchmark.yml --repo "$GITHUB_REPOSITORY" --ref main