diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 53ecd37444..12ebd8541c 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -5,6 +5,13 @@ 'helpers:pinGitHubActionDigestsToSemver', ':separateMultipleMajorReleases', ], + gitIgnoredAuthors: [ + "107717825+opentelemetrybot@users.noreply.github.com", + "107717825+opentelemetrybot[bot]@users.noreply.github.com", + "197425009+otelbot@users.noreply.github.com", + "197425009+otelbot[bot]@users.noreply.github.com", + "github-actions[bot]@users.noreply.github.com" + ], prHourlyLimit: 15, prConcurrentLimit: 15, ignorePaths: [ diff --git a/.github/workflows/renovate-go.yml b/.github/workflows/renovate-go.yml new file mode 100644 index 0000000000..59547711c5 --- /dev/null +++ b/.github/workflows/renovate-go.yml @@ -0,0 +1,52 @@ +name: Renovate Post-Update Tasks / Go + +on: + pull_request: + types: [opened, synchronize, edited] + paths: + - '**/go.mod' + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + gomodtidy: + # Only run on Renovate PRs + if: startsWith(github.head_ref, 'renovate/') + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 + with: + go-version-file: collector/go.mod + - run: find . -name "go.mod" -execdir go mod tidy \; + - name: Check if go mod changed + id: check_changes + env: + BASE_REF: ${{ github.base_ref }} + run: | + git fetch origin "$BASE_REF" + if git diff --name-only "origin/$BASE_REF" HEAD \ + | grep -E '^(.*/)?go\.(mod|sum)$' >/dev/null; then + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "changed=false" >> $GITHUB_OUTPUT + fi + - name: Commit and push changes + if: steps.check_changes.outputs.changed == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add collector/ + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "chore: go mod tidy" + git push + fi