Sync Upstream #5530
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |