-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make dependabot run cargo-hakari at the end (#4557)
- Loading branch information
1 parent
dc52317
commit 17b6b89
Showing
1 changed file
with
37 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,24 +1,50 @@ | ||
name: auto-merge | ||
name: auto-merge & finishing steps for dependabot | ||
|
||
on: | ||
pull_request_target: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
# Merge pull requests from dependabot that upgrade a minor version number and pass CI | ||
auto-merge: | ||
permissions: | ||
contents: none | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- 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}} | ||
- uses: actions/checkout@v3 | ||
- uses: ahmadnassri/[email protected] | ||
with: | ||
github-token: ${{ secrets.AUTOMERGE_TOKEN }} | ||
command: 'squash and merge' | ||
target: minor | ||
ref: ${{ github.head_ref }} | ||
- uses: actions-rs/toolchain@v1 | ||
- name: Install cargo-hakari, and cache the binary | ||
uses: baptiste0928/cargo-install@v1 | ||
with: | ||
crate: cargo-hakari | ||
locked: true | ||
- name: run cargo-hakari | ||
run: | | ||
cargo hakari generate | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) | ||
- name: Push changes | ||
if: steps.git-check.outputs.modified == 'true' | ||
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.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git commit -am "chore(deps): cargo hakari" | ||
git push |