diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index b665c02..b1d4e8c 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,19 +1,17 @@ name: Dependabot auto-approve -on: pull_request_target +on: pull_request permissions: pull-requests: write + jobs: dependabot: runs-on: ubuntu-latest - # Checking the author will prevent your Action run failing on non-Dependabot PRs - if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} steps: - - name: Dependabot metadata - id: dependabot-metadata - uses: dependabot/fetch-metadata@v1.3.0 + - uses: actions/checkout@v3 - name: Approve a PR run: | - if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" == "REVIEW_REQUIRED" ]; + gh pr checkout "$PR_URL" + if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; then gh pr review --approve "$PR_URL" else echo "PR already approved, skipping additional approvals to minimize emails/notification noise."; fi diff --git a/.github/workflows/gh-pr-status.yml b/.github/workflows/gh-pr-status.yml new file mode 100644 index 0000000..9698887 --- /dev/null +++ b/.github/workflows/gh-pr-status.yml @@ -0,0 +1,18 @@ +name: Get results of `gh pr status` +on: pull_request +permissions: + pull-requests: write + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + gh pr checkout $PR_URL + BODY=$(gh pr status --json title) + gh pr comment "$PR_URL" -b "$BODY" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} +