Repository navigation
chore: identical-argument scenario for the hints harness (RIUS-1727) #136
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
| # Watches upstream for renames of gen_ai.* attributes we emit. | |
| # | |
| # The GenAI semantic conventions live in semantic-conventions-genai, which | |
| # cuts NO releases — renames exist only on its main branch, and the published | |
| # docs site lags or tombstones them. That is how cache_creation shipped here | |
| # two weeks after upstream renamed it to cache_write. Polling upstream main | |
| # is the only watchable surface. | |
| # | |
| # Two triggers, two behaviors: on pull_request drift just fails the job, so a | |
| # semconv change cannot land against a stale upstream; on schedule, drift | |
| # files ONE issue (deduplicated by marker) because a rename is a wire change | |
| # and a judgement call (port it, or declare the attribute RIUS_ONLY) that a | |
| # bot must not pick. | |
| # | |
| # This checks OUR names against upstream. A rename is ported in the | |
| # rius-semconv registry, not here, and reaches both SDKs when each re-pins | |
| # the release that carries it. | |
| name: semconv-upstream | |
| on: | |
| pull_request: | |
| paths: | |
| - "src/rius/semconv.py" | |
| - "src/rius/_semconv_generated.py" | |
| - "scripts/check_upstream_semconv.py" | |
| - ".github/workflows/semconv-upstream.yml" | |
| schedule: | |
| - cron: "0 6 * * 1" # Mondays, hours before the GenAI SIG agent call | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Runs the PR's own script, so it gets a read-only token. Filing the issue | |
| # lives in a separate job that never runs on pull_request. | |
| check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| code: ${{ steps.check.outputs.code }} | |
| report: ${{ steps.check.outputs.report }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Check emitted attributes against the upstream registry | |
| id: check | |
| run: | | |
| set +e | |
| python3 scripts/check_upstream_semconv.py | tee check-output.txt | |
| code=${PIPESTATUS[0]} | |
| set -e | |
| echo "code=$code" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "report<<SEMCONV_REPORT_EOF" | |
| cat check-output.txt | |
| echo "SEMCONV_REPORT_EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| # On pull_request any nonzero code fails the job right here. On | |
| # schedule/dispatch, drift (2) falls through to the issue job; | |
| # fetch/parse breakage (3) still fails the run so it is visible. | |
| if [ "${{ github.event_name }}" = "pull_request" ] || [ "$code" = "3" ]; then | |
| exit "$code" | |
| fi | |
| file-issue: | |
| needs: check | |
| if: ${{ github.event_name != 'pull_request' && needs.check.outputs.code == '2' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write # files or updates the drift issue | |
| steps: | |
| - name: File (or update) the drift issue | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| REPORT: ${{ needs.check.outputs.report }} | |
| run: | | |
| marker="semconv-upstream-drift" | |
| # The backticks in the printf format are a literal Markdown fence. | |
| # shellcheck disable=SC2016 | |
| body="$(printf '<!-- %s -->\nUpstream renamed, removed, or re-scoped attributes we emit. This is a wire change and a judgement call: port the rename (SDK + docs + backend read paths), or declare the attribute RIUS_ONLY in scripts/check_upstream_semconv.py with a reason.\n\n```\n%s\n```\n\nLatest run: %s/%s/actions/runs/%s' \ | |
| "$marker" "$REPORT" "$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID")" | |
| existing=$(gh issue list --state open --search "in:body $marker" --json number --jq '.[0].number') | |
| if [ -n "$existing" ]; then | |
| gh issue comment "$existing" --body "$body" | |
| else | |
| gh issue create \ | |
| --title "gen_ai.* attributes drifted from the upstream GenAI registry" \ | |
| --body "$body" | |
| fi |