-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dddfabe
commit ee5a083
Showing
1 changed file
with
64 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Dependabot Approve and Merge | ||
|
||
on: | ||
pull_request_target: | ||
|
||
jobs: | ||
dependabot: | ||
name: Auto approve | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
|
||
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} | ||
steps: | ||
- name: Fetch update types | ||
id: update-types | ||
env: | ||
UPDATE_TYPES: 'version-update:semver-patch version-update:semver-minor' | ||
run: | | ||
arr=(${UPDATE_TYPES//;/ }) | ||
count=${#arr[@]} | ||
echo "Types: ${arr[*]}" | ||
echo "Count: ${count}" | ||
echo "types=${arr[*]}" >> $GITHUB_OUTPUT | ||
echo "count=${count}" >> $GITHUB_OUTPUT | ||
- name: Fetch Dependabot metadata | ||
if: ${{ fromJson(steps.update-types.outputs.count) > 0 }} | ||
id: dependabot-metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
|
||
- name: Generate token | ||
id: generate-token | ||
if: ${{ fromJson(steps.update-types.outputs.count) > 0 && contains(steps.update-types.outputs.types, steps.dependabot-metadata.outputs.update-type) }} | ||
uses: tibdex/github-app-token@v2 | ||
with: | ||
app_id: ${{ secrets.BOT_APP_ID }} | ||
private_key: ${{ secrets.BOT_PRIVATE_KEY }} | ||
|
||
- name: Authenticate cli | ||
id: authenticate-cli | ||
if: ${{ fromJson(steps.update-types.outputs.count) > 0 && contains(steps.update-types.outputs.types, steps.dependabot-metadata.outputs.update-type) }} | ||
run: echo "${{ steps.generate-token.outputs.token }}" | gh auth login --with-token | ||
|
||
- name: Approve and auto-merge | ||
id: auto-merge | ||
if: ${{ fromJson(steps.update-types.outputs.count) > 0 && contains(steps.update-types.outputs.types, steps.dependabot-metadata.outputs.update-type) }} | ||
run: | | ||
gh pr edit "$PR_URL" --add-label "auto-merged" | ||
gh pr review --approve "$PR_URL" | ||
gh pr merge --auto --merge "$PR_URL" | ||
echo "STATUS=true" >> $GITHUB_OUTPUT | ||
env: | ||
PR_URL: ${{ github.event.pull_request.html_url }} | ||
|
||
- name: Write summary | ||
run: | | ||
result="skip. :x:" | ||
if [ "${STATUS}" == "true" ]; then | ||
result=" auto-merge! :white_check_mark:" | ||
fi | ||
echo "### Done with ${result}" >> $GITHUB_STEP_SUMMARY | ||
env: | ||
STATUS: ${{ steps.auto-merge.outputs.STATUS }} |
ee5a083
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.
Successfully deployed to the following URLs:
portfolio – ./
portfolio-womb0comb0.vercel.app
mikeodnis.com
portfolio-git-master-womb0comb0.vercel.app
www.mikeodnis.com