-
Couldn't load subscription status.
- Fork 117
chore: add dependabot config #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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}} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| #!/usr/bin/env php | ||
| <?php | ||
|
|
||
| /** | ||
| * Script to automatically generate dependabot.yml configuration based on directory structure. | ||
| * | ||
| * This script scans the project for composer.json files and generates a dependabot.yml | ||
| * configuration file with appropriate settings for each package. | ||
| * | ||
| * Usage: php scripts/generate-dependabot-config.php | ||
| */ | ||
|
|
||
| // Configuration | ||
| $rootDir = dirname(__DIR__); | ||
| $outputFile = $rootDir . '/.github/dependabot.yml'; | ||
| $scanDirs = [ | ||
| $rootDir, | ||
| $rootDir . '/src', | ||
| $rootDir . '/examples', | ||
| ]; | ||
|
|
||
| // Initialize YAML content | ||
| $yaml = [ | ||
| '# Dependabot configuration file', | ||
| '# See: https://docs.github.com/github/administering-a-repository/', | ||
| '# configuration-options-for-dependency-updates', | ||
| '', | ||
| 'version: 2', | ||
| 'updates:', | ||
| ]; | ||
|
|
||
| // Add root project configuration | ||
| $yaml[] = ' # Maintain dependencies for the root project'; | ||
| $yaml[] = ' - package-ecosystem: "composer"'; | ||
| $yaml[] = ' directory: "/"'; | ||
| $yaml[] = ' schedule:'; | ||
| $yaml[] = ' interval: "weekly"'; | ||
| $yaml[] = ' open-pull-requests-limit: 10'; | ||
| $yaml[] = ' labels:'; | ||
| $yaml[] = ' - "dependencies"'; | ||
| $yaml[] = ' versioning-strategy: "auto"'; | ||
| $yaml[] = ' allow:'; | ||
| $yaml[] = ' - dependency-type: "direct"'; | ||
| $yaml[] = ' - dependency-type: "indirect"'; | ||
| $yaml[] = ' groups:'; | ||
| $yaml[] = ' dev-dependencies:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "friendsofphp/php-cs-fixer"'; | ||
| $yaml[] = ' - "phan/phan"'; | ||
| $yaml[] = ' - "phpstan/phpstan*"'; | ||
| $yaml[] = ' - "phpunit/phpunit"'; | ||
| $yaml[] = ' - "vimeo/psalm"'; | ||
| $yaml[] = ' - "psalm/plugin-phpunit"'; | ||
| $yaml[] = ' exclude-patterns:'; | ||
| $yaml[] = ' - "open-telemetry/*"'; | ||
| $yaml[] = ' open-telemetry:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "open-telemetry/*"'; | ||
| $yaml[] = ' symfony:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "symfony/*"'; | ||
| $yaml[] = ' ignore:'; | ||
| $yaml[] = ' - dependency-name: "*"'; | ||
| $yaml[] = ' update-types: ["version-update:semver-major"]'; | ||
| $yaml[] = ' commit-message:'; | ||
| $yaml[] = ' prefix: "chore"'; | ||
| $yaml[] = ' prefix-development: "chore"'; | ||
| $yaml[] = ' include: "scope"'; | ||
| $yaml[] = ''; | ||
|
|
||
| // Add GitHub Actions configuration | ||
| $yaml[] = ' # Maintain dependencies for GitHub Actions'; | ||
| $yaml[] = ' - package-ecosystem: "github-actions"'; | ||
| $yaml[] = ' directory: "/"'; | ||
| $yaml[] = ' schedule:'; | ||
| $yaml[] = ' interval: "weekly"'; | ||
| $yaml[] = ' open-pull-requests-limit: 10'; | ||
| $yaml[] = ' labels:'; | ||
| $yaml[] = ' - "dependencies"'; | ||
| $yaml[] = ' commit-message:'; | ||
| $yaml[] = ' prefix: "chore"'; | ||
| $yaml[] = ' prefix-development: "chore"'; | ||
| $yaml[] = ' include: "scope"'; | ||
| $yaml[] = ''; | ||
|
|
||
| // Find all composer.json files | ||
| $composerFiles = []; | ||
| foreach ($scanDirs as $scanDir) { | ||
| findComposerFiles($scanDir, $composerFiles, $rootDir); | ||
| } | ||
|
|
||
| // Filter out the root composer.json as it's already configured | ||
| $packageDirectories = []; | ||
| foreach ($composerFiles as $composerFile) { | ||
| if ($composerFile !== '/') { | ||
| $packageDirectories[] = $composerFile; | ||
| } | ||
| } | ||
|
|
||
| // Add a single configuration for all package directories | ||
| if (!empty($packageDirectories)) { | ||
| $yaml[] = ' # Maintain dependencies for all packages'; | ||
| $yaml[] = ' - package-ecosystem: "composer"'; | ||
| $yaml[] = ' directories:'; | ||
|
|
||
| // Sort directories for consistent output | ||
| sort($packageDirectories); | ||
| foreach ($packageDirectories as $directory) { | ||
| $yaml[] = ' - "' . $directory . '"'; | ||
| } | ||
|
|
||
| $yaml[] = ' schedule:'; | ||
| $yaml[] = ' interval: "weekly"'; | ||
| $yaml[] = ' labels:'; | ||
| $yaml[] = ' - "dependencies"'; | ||
| $yaml[] = ' groups:'; | ||
| $yaml[] = ' dev-dependencies:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "friendsofphp/php-cs-fixer"'; | ||
| $yaml[] = ' - "phan/phan"'; | ||
| $yaml[] = ' - "phpstan/phpstan*"'; | ||
| $yaml[] = ' - "phpunit/phpunit"'; | ||
| $yaml[] = ' - "vimeo/psalm"'; | ||
| $yaml[] = ' - "psalm/plugin-phpunit"'; | ||
| $yaml[] = ' laravel:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "laravel/*"'; | ||
| $yaml[] = ' - "illuminate/*"'; | ||
| $yaml[] = ' open-telemetry:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "open-telemetry/*"'; | ||
| $yaml[] = ' symfony:'; | ||
| $yaml[] = ' patterns:'; | ||
| $yaml[] = ' - "symfony/*"'; | ||
| $yaml[] = ' ignore:'; | ||
| $yaml[] = ' - dependency-name: "*"'; | ||
| $yaml[] = ' update-types: ["version-update:semver-major"]'; | ||
| $yaml[] = ' commit-message:'; | ||
| $yaml[] = ' prefix: "chore"'; | ||
| $yaml[] = ' prefix-development: "chore"'; | ||
| $yaml[] = ' include: "scope"'; | ||
| $yaml[] = ''; | ||
| } | ||
|
|
||
| // Write the YAML file | ||
| file_put_contents($outputFile, implode("\n", $yaml)); | ||
|
|
||
| echo "Dependabot configuration generated at: $outputFile\n"; | ||
| echo "Found " . count($composerFiles) . " composer.json files.\n"; | ||
|
|
||
| /** | ||
| * Recursively find composer.json files in the given directory. | ||
| * | ||
| * @param string $dir The directory to scan | ||
| * @param array $results Array to store results | ||
| * @param string $rootDir The root directory of the project | ||
| */ | ||
| function findComposerFiles($dir, &$results, $rootDir) { | ||
| $files = scandir($dir); | ||
|
|
||
| foreach ($files as $file) { | ||
| if ($file === '.' || $file === '..' || $file === 'vendor') { | ||
| continue; | ||
| } | ||
|
|
||
| $path = $dir . '/' . $file; | ||
|
|
||
| if (is_dir($path)) { | ||
| // Skip vendor directories | ||
| if (strpos($path, '/vendor/') !== false) { | ||
| continue; | ||
| } | ||
|
|
||
| findComposerFiles($path, $results, $rootDir); | ||
| } elseif ($file === 'composer.json') { | ||
| // Get relative path from root | ||
| $relativePath = str_replace($rootDir, '', dirname($path)); | ||
| $relativePath = $relativePath ?: '/'; | ||
|
|
||
| // Add to results if not already present | ||
| if (!in_array($relativePath, $results)) { | ||
| $results[] = $relativePath; | ||
| } | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should generate a PR, since nobody, including dependabot, can commit to main. See current CI/action failures.