docs(changelog): 2.0.3 #1
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
| name: "Dependabot Safe Auto-merge for Patch and Minor Updates" | |
| on: | |
| pull_request_target: | |
| branches: | |
| - main | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| auto-merge: | |
| if: github.actor == 'dependabot[bot]' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch Dependabot metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Decide if this PR is eligible | |
| id: decision | |
| env: | |
| PACKAGE_ECOSYSTEM: ${{ steps.metadata.outputs.package-ecosystem }} | |
| UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }} | |
| run: | | |
| should_automerge=false | |
| if [[ "$PACKAGE_ECOSYSTEM" == "github-actions" ]]; then | |
| if [[ "$UPDATE_TYPE" == "version-update:semver-patch" || "$UPDATE_TYPE" == "version-update:semver-minor" ]]; then | |
| should_automerge=true | |
| fi | |
| fi | |
| if [[ "$PACKAGE_ECOSYSTEM" == "pip" ]]; then | |
| if [[ "$UPDATE_TYPE" == "version-update:semver-patch" ]]; then | |
| should_automerge=true | |
| fi | |
| fi | |
| echo "should_automerge=$should_automerge" >> "$GITHUB_OUTPUT" | |
| echo "package_ecosystem=$PACKAGE_ECOSYSTEM" >> "$GITHUB_OUTPUT" | |
| echo "update_type=$UPDATE_TYPE" >> "$GITHUB_OUTPUT" | |
| - name: Approve eligible PR | |
| if: steps.decision.outputs.should_automerge == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| await github.rest.pulls.createReview({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| event: "APPROVE", | |
| body: "Auto-approved for safe Dependabot update policy." | |
| }) | |
| - name: Enable auto-merge for eligible PR | |
| if: steps.decision.outputs.should_automerge == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| try { | |
| await github.graphql( | |
| `mutation($pullRequestId: ID!) { | |
| enablePullRequestAutoMerge(input: {pullRequestId: $pullRequestId, mergeMethod: SQUASH}) { | |
| pullRequest { number } | |
| } | |
| }`, | |
| { pullRequestId: context.payload.pull_request.node_id } | |
| ) | |
| } catch (error) { | |
| core.setFailed( | |
| "Could not enable auto-merge. Ensure repository auto-merge is enabled and branch protections are satisfied.\n" + | |
| error.message | |
| ) | |
| } | |
| - name: Log skipped PR | |
| if: steps.decision.outputs.should_automerge != 'true' | |
| run: | | |
| echo "Automerge skipped by policy." | |
| echo "ecosystem=${{ steps.decision.outputs.package_ecosystem }}" | |
| echo "update_type=${{ steps.decision.outputs.update_type }}" |