1+ name : Dependabot Auto-Approve 
2+ 
3+ on : pull_request 
4+ 
5+ permissions :
6+   pull-requests : write 
7+   contents : write 
8+ 
9+ env :
10+   CARGO_ABOUT_VERSION : 0.8.2 
11+ 
12+ jobs :
13+   auto-approve :
14+     runs-on : ubuntu-latest 
15+     if : | 
16+       github.repository == 'mongodb/atlas-local-lib-js' && 
17+       github.event.pull_request.user.login == 'dependabot[bot]' 
18+ steps :
19+       - name : Checkout PR 
20+         uses : actions/checkout@v5 
21+         with :
22+           token : ${{ secrets.GITHUB_TOKEN }} 
23+           ref : ${{ github.event.pull_request.head.ref }} 
24+           repository : ${{ github.event.pull_request.head.repo.full_name }} 
25+ 
26+       - name : Install Rust toolchain 
27+         run : | 
28+           rustup update stable 
29+           rustup default stable 
30+ 
31+ name : Cache cargo tools 
32+         uses : actions/cache@v4 
33+         with :
34+           path : ~/.cargo/bin 
35+           key : ${{ runner.os }}-cargo-tools-about-${{ env.CARGO_ABOUT_VERSION }} 
36+           restore-keys : | 
37+             ${{ runner.os }}-cargo-tools- 
38+ 
39+ name : Install cargo-about 
40+         run : | 
41+           if ! command -v cargo-about &> /dev/null; then 
42+             cargo install --locked --version ${{ env.CARGO_ABOUT_VERSION }} cargo-about 
43+           fi 
44+ 
45+ name : Dependabot metadata 
46+         id : metadata 
47+         uses : dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b 
48+         with :
49+           github-token : " ${{ secrets.GITHUB_TOKEN }}" 
50+       
51+       - name : Update third-party licenses 
52+         if : steps.metadata.outputs.package-ecosystem == 'cargo' 
53+         run : | 
54+           # Generate updated LICENSE-3RD-PARTY.txt 
55+           cargo about generate about.hbs > LICENSE-3RD-PARTY.txt 
56+            
57+           # Check if there are changes to commit 
58+           if ! git diff --quiet LICENSE-3RD-PARTY.txt; then 
59+             git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 
60+             git config --local user.name "github-actions[bot]" 
61+             git add LICENSE-3RD-PARTY.txt 
62+             git commit -m "chore(deps): update LICENSE-3RD-PARTY.txt" 
63+             git push 
64+             echo "Updated LICENSE-3RD-PARTY.txt" 
65+           else 
66+             echo "LICENSE-3RD-PARTY.txt is already up to date" 
67+           fi 
68+ 
69+ name : Approve Dependabot PR 
70+         if : steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' || contains(steps.metadata.outputs.dependency-names, 'security') || steps.metadata.outputs.package-ecosystem == 'github_actions' 
71+         run : gh pr review --approve "$PR_URL" 
72+         env :
73+           PR_URL : ${{ github.event.pull_request.html_url }} 
74+           GH_TOKEN : ${{ secrets.GITHUB_TOKEN }} 
75+       
76+       - name : Enable auto-merge for Dependabot PR 
77+         if : steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' || contains(steps.metadata.outputs.dependency-names, 'security') || steps.metadata.outputs.package-ecosystem == 'github_actions' 
78+         run : gh pr merge --auto --squash "$PR_URL" 
79+         env :
80+           PR_URL : ${{ github.event.pull_request.html_url }} 
81+           GH_TOKEN : ${{ secrets.GITHUB_TOKEN }} 
0 commit comments