Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-murakami committed Aug 31, 2023
1 parent 6cbdc48 commit 84f6e98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
id: check
run: |
commit_sha=$(git rev-parse HEAD)
repo_url="https://api.github.com/repos/${{ github.repository }}"
repo_url="https://github.com/laststance/${{ github.repository }}"
checks_url="${repo_url}/commits/${commit_sha}/check-runs"
# Fetch all check runs for the commit
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,19 @@ jobs:
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Check if PR is approved
id: check_approval
run: |
pr_number=${{ github.event.pull_request.number }}
repo_url="https://github.com/laststance/${{ github.repository }}/pulls/${pr_number}/reviews"
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $repo_url)
approved=$(echo "$response" | jq -r 'any(.[]; .state == "APPROVED")')
echo "APPROVED=$approved" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
if: env.APPROVED == 'true'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 84f6e98

Please sign in to comment.