forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 2.15 KB
/
dependabot-auto-merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: auto-merge & finishing steps for dependabot
on:
pull_request_target:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@efb5c8deb113433243b6b08de1aa879d5aa01cf7 # [email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@7dd9e2a3dc350cf687eb1b2a4fadfee8c8e49675 # pin@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.AUTOMERGE_TOKEN }}
- name: Install cargo-hakari, and cache the binary
uses: baptiste0928/cargo-install@48c92f3d491efa23daace9891498a14c5aaa1afd # pin@v2
with:
crate: cargo-hakari
locked: true
- name: run cargo-hakari
run: |
cargo hakari generate
- name: Check for modified files
id: git-check
run: echo modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) >> $GITHUB_OUTPUT
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
# using secrets.AUTOMERGE_TOKEN in the below is key to re-trigger CI
run: |
git config --global user.name 'Francois Garillot'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.AUTOMERGE_TOKEN }}@github.com/${{ github.repository }}
git commit -am "chore(deps): cargo hakari"
git push
- name: Dependabot Auto Merge
uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
command: 'squash and merge'
target: minor
- name: Enable auto-merge for Dependabot PRs on patch versions
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}