diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 2bf358ef13..05f465cf7d 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -28,10 +28,30 @@ { matchPackageNames: [ 'otel/**', + 'open-telemetry/opentelemetry-specification', ], schedule: ['at any time'], }, ], + customManagers: [ + { + customType: "regex", + description: "Update otel spec version in docs", + managerFilePatterns: [ + "docs/**/*.md", + "README.md", + ], + matchStrings: [ + "https://github.com/open-telemetry/opentelemetry-specification/blob/(?v[0-9.]+?)/(?!.*/semantic_conventions/)", + "https://img.shields.io/badge/OTel_specification_version-(?v[0-9.]+?)-", + "https://github.com/open-telemetry/opentelemetry-specification/releases/tag/(?v[0-9.]+?)\\)", + ], + datasourceTemplate: "github-tags", + packageNameTemplate: "open-telemetry/opentelemetry-specification", + versioningTemplate: "semver", + currentValueTemplate: "{{depVersion}}", + }, + ], "lockFileMaintenance": { "enabled": true, "schedule": ["* 0-7 * * 2"] // weekly, before 8am on Tuesday diff --git a/.github/scripts/update-spec-repo-links.sh b/.github/scripts/update-spec-repo-links.sh deleted file mode 100755 index 28fc5e77ea..0000000000 --- a/.github/scripts/update-spec-repo-links.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# Example usage: -# -# ./internal/tools/update-spec-repo-links.sh v1.41.0 - -# Set this to the version number you want to KEEP in URLs in the repository. -LATEST_SPECIFICATION_VERSION=$1 -# The specific pattern we look for when replacing URLs -SPECIFICATION_URL_PREFIX="https://github.com/open-telemetry/opentelemetry-specification/blob/" -# The specific pattern we look for updating the Badge with the spec version -SPECIFICATION_BADGE_PREFIX="https://img.shields.io/badge/OTel_specification_version-" -SPECIFICATION_BADGE_RELEASE_TAG_PREFIX="https://github.com/open-telemetry/opentelemetry-specification/releases/tag/" - -fix_file() { - echo Fixing file "$1" - - # Replace any versioned spec URL/badge with the latest version. - # Uses a negative lookahead to skip URLs pointing to semantic_conventions/ - # paths that were moved from the spec repo and no longer exist in newer versions. - perl -pi -e " - s,\Q${SPECIFICATION_URL_PREFIX}\Ev1\.\d+\.\d+(?!.*/semantic_conventions/),${SPECIFICATION_URL_PREFIX}${LATEST_SPECIFICATION_VERSION},g; - s,\Q${SPECIFICATION_BADGE_PREFIX}\Ev1\.\d+\.\d+,${SPECIFICATION_BADGE_PREFIX}${LATEST_SPECIFICATION_VERSION},g; - s,\Q${SPECIFICATION_BADGE_RELEASE_TAG_PREFIX}\Ev1\.\d+\.\d+,${SPECIFICATION_BADGE_RELEASE_TAG_PREFIX}${LATEST_SPECIFICATION_VERSION},g; - " "$1" -} - -important_files=("docs" "model" "README.md") - -# TODO - limit to markdown/yaml files? -find "${important_files[@]}" -type f -not -path '*/.*' -not -path '*.png' -print0 | while read -d $'\0' file; do - fix_file "$file" -done diff --git a/.github/workflows/auto-update-spec-repo-links.yml b/.github/workflows/auto-update-spec-repo-links.yml deleted file mode 100644 index 96043667cf..0000000000 --- a/.github/workflows/auto-update-spec-repo-links.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Auto-update spec repo links -on: - schedule: - # hourly at minute 46 - - cron: "46 * * * *" - workflow_dispatch: - -permissions: - contents: read - -jobs: - check-versions: - runs-on: ubuntu-latest - if: github.repository_owner == 'open-telemetry' - outputs: - latest-version: ${{ steps.check-versions.outputs.latest-version }} - already-opened: ${{ steps.check-versions.outputs.already-opened }} - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - id: check-versions - name: Check versions - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - latest_version=$(gh release view \ - --repo open-telemetry/opentelemetry-specification \ - --json tagName \ - --jq .tagName) - - matches=$(gh pr list \ - --author otelbot[bot] \ - --state open \ - --search "in:title \"Update spec repo links to $latest_version\"") - if [ ! -z "$matches" ] - then - already_opened=true - fi - - echo "latest-version=$latest_version" >> $GITHUB_OUTPUT - echo "already-opened=$already_opened" >> $GITHUB_OUTPUT - - update-spec-repo-links: - permissions: - contents: write # required for pushing changes - runs-on: ubuntu-latest - if: | - needs.check-versions.outputs.already-opened != 'true' - needs: - - check-versions - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Use CLA approved github bot - run: .github/scripts/use-cla-approved-github-bot.sh - - - name: Update version - env: - VERSION: ${{ needs.check-versions.outputs.latest-version }} - run: .github/scripts/update-spec-repo-links.sh $VERSION - - - uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 - id: otelbot-token - with: - app-id: ${{ vars.OTELBOT_APP_ID }} - private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }} - - - name: Create pull request - env: - VERSION: ${{ needs.check-versions.outputs.latest-version }} - # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GH_TOKEN: ${{ steps.otelbot-token.outputs.token }} - run: | - message="Update spec repo links to $VERSION" - body="Update spec repo links to \`$VERSION\`." - branch="otelbot/update-spec-repo-links-to-$VERSION" - - git checkout -b $branch - git commit -a -m "$message" - git push --set-upstream origin $branch - gh pr create --title "[chore] $message" \ - --body "$body" \ - --base main