diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..b73a41309 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,130 @@ +# Dependabot configuration file +# See: https://docs.github.com/github/administering-a-repository/ +# configuration-options-for-dependency-updates + +version: 2 +updates: + # Maintain dependencies for the root project + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + labels: + - "dependencies" + versioning-strategy: "auto" + allow: + - dependency-type: "direct" + - dependency-type: "indirect" + groups: + dev-dependencies: + patterns: + - "friendsofphp/php-cs-fixer" + - "phan/phan" + - "phpstan/phpstan*" + - "phpunit/phpunit" + - "vimeo/psalm" + - "psalm/plugin-phpunit" + exclude-patterns: + - "open-telemetry/*" + open-telemetry: + patterns: + - "open-telemetry/*" + symfony: + patterns: + - "symfony/*" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + commit-message: + prefix: "chore" + prefix-development: "chore" + include: "scope" + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + labels: + - "dependencies" + commit-message: + prefix: "chore" + prefix-development: "chore" + include: "scope" + + # Maintain dependencies for all packages + - package-ecosystem: "composer" + directories: + - "/examples/aws/AwsClientApp" + - "/examples/instrumentation/Wordpress" + - "/src/AutoInstrumentationInstaller" + - "/src/Aws" + - "/src/Context/Swoole" + - "/src/Instrumentation/CakePHP" + - "/src/Instrumentation/CodeIgniter" + - "/src/Instrumentation/Curl" + - "/src/Instrumentation/Doctrine" + - "/src/Instrumentation/ExtAmqp" + - "/src/Instrumentation/ExtRdKafka" + - "/src/Instrumentation/Guzzle" + - "/src/Instrumentation/HttpAsyncClient" + - "/src/Instrumentation/IO" + - "/src/Instrumentation/Laravel" + - "/src/Instrumentation/MongoDB" + - "/src/Instrumentation/MySqli" + - "/src/Instrumentation/OpenAIPHP" + - "/src/Instrumentation/PDO" + - "/src/Instrumentation/Psr14" + - "/src/Instrumentation/Psr15" + - "/src/Instrumentation/Psr16" + - "/src/Instrumentation/Psr18" + - "/src/Instrumentation/Psr3" + - "/src/Instrumentation/Psr6" + - "/src/Instrumentation/Slim" + - "/src/Instrumentation/Symfony" + - "/src/Instrumentation/Wordpress" + - "/src/Instrumentation/Yii" + - "/src/Logs/Monolog" + - "/src/MetaPackages/opentelemetry" + - "/src/Propagation/ServerTiming" + - "/src/Propagation/TraceResponse" + - "/src/ResourceDetectors/Azure" + - "/src/ResourceDetectors/Container" + - "/src/Sampler/RuleBased" + - "/src/Shims/OpenTracing" + - "/src/Symfony" + - "/src/Symfony/src/OtelBundle" + - "/src/Symfony/src/OtelSdkBundle" + - "/src/Utils/Test" + schedule: + interval: "weekly" + labels: + - "dependencies" + groups: + dev-dependencies: + patterns: + - "friendsofphp/php-cs-fixer" + - "phan/phan" + - "phpstan/phpstan*" + - "phpunit/phpunit" + - "vimeo/psalm" + - "psalm/plugin-phpunit" + laravel: + patterns: + - "laravel/*" + - "illuminate/*" + open-telemetry: + patterns: + - "open-telemetry/*" + symfony: + patterns: + - "symfony/*" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + commit-message: + prefix: "chore" + prefix-development: "chore" + include: "scope" diff --git a/.github/workflows/dependabot-auto-approve.yml b/.github/workflows/dependabot-auto-approve.yml new file mode 100644 index 000000000..d8690791c --- /dev/null +++ b/.github/workflows/dependabot-auto-approve.yml @@ -0,0 +1,21 @@ +name: Dependabot auto-approve +on: pull_request + +permissions: + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'open-telemetry/opentelemetry-php-contrib' + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/update-dependabot-config.yml b/.github/workflows/update-dependabot-config.yml new file mode 100644 index 000000000..e937f2c60 --- /dev/null +++ b/.github/workflows/update-dependabot-config.yml @@ -0,0 +1,42 @@ +name: Update Dependabot Configuration + +on: + schedule: + # Run daily at midnight UTC + - cron: '0 0 * * *' + # Allow manual triggering + workflow_dispatch: + +jobs: + update-dependabot-config: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + extensions: json + coverage: none + + - name: Generate dependabot configuration + run: php scripts/generate-dependabot-config.php + + - name: Check for changes + id: git-check + run: | + git diff --exit-code .github/dependabot.yml || echo "changes=true" >> $GITHUB_OUTPUT + + - name: Commit and push if changed + if: steps.git-check.outputs.changes == 'true' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add .github/dependabot.yml + git commit -m "chore: update dependabot configuration [skip ci]" + git push diff --git a/scripts/generate-dependabot-config.php b/scripts/generate-dependabot-config.php new file mode 100755 index 000000000..b8583de67 --- /dev/null +++ b/scripts/generate-dependabot-config.php @@ -0,0 +1,186 @@ +#!/usr/bin/env php +