Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ jobs:
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Verify bot identity
run: |
BOT_LOGIN="$(gh api user --jq .login)"
test "$BOT_LOGIN" = "eplus-bot"
env:
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}
52 changes: 41 additions & 11 deletions .github/workflows/pr-auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Wait for pull request checks
run: gh pr checks "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --watch --interval 10
env:
PR_NUMBER: ${{steps.pr.outputs.number}}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Approve pull request
run: |
APPROVED_FOR_HEAD="$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \
Expand All @@ -61,6 +67,36 @@ jobs:
--jq ".[] | select(.user.login == \"eplus-bot\" and (.body | contains(\"$COMMENT_MARKER\"))) | .id" \
| tail -n 1)"

REFRESH_COUNT="1"
if [ -n "$COMMENT_ID" ]; then
OLD_REFRESH_COUNT="$(gh api "repos/$GITHUB_REPOSITORY/issues/comments/$COMMENT_ID" \
--jq '.body' \
| sed -n 's/^Approval refresh: #\([0-9][0-9]*\)$/\1/p' \
| tail -n 1)"

if [ -n "$OLD_REFRESH_COUNT" ]; then
REFRESH_COUNT="$((OLD_REFRESH_COUNT + 1))"
else
REFRESH_COUNT="2"
fi
fi

APPROVAL_COMMENT="$(cat <<EOF
$COMMENT_MARKER

![CI passed](https://img.shields.io/badge/CI-passed-brightgreen)

Approved by @eplus-bot after all pull request checks passed.

Approval refresh: #$REFRESH_COUNT
CI updated: $CI_UPDATED_AT
CI attempt: #$CI_RUN_ATTEMPT
Approval workflow: #$APPROVAL_RUN_NUMBER.$APPROVAL_RUN_ATTEMPT

CI run: $CI_RUN_URL
EOF
)"

if [ -n "$COMMENT_ID" ]; then
gh api \
--method PATCH \
Expand All @@ -75,15 +111,9 @@ jobs:
env:
PR_NUMBER: ${{steps.pr.outputs.number}}
COMMENT_MARKER: "<!-- eplus-bot-ci-approval -->"
APPROVAL_COMMENT: |
<!-- eplus-bot-ci-approval -->

![CI passed](https://img.shields.io/badge/CI-passed-brightgreen)

Approved by @eplus-bot after CI passed.

Updated: ${{ github.event.workflow_run.updated_at }}
Run attempt: #${{ github.event.workflow_run.run_attempt }}

CI run: ${{ github.event.workflow_run.html_url }}
CI_UPDATED_AT: ${{ github.event.workflow_run.updated_at }}
CI_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
CI_RUN_URL: ${{ github.event.workflow_run.html_url }}
APPROVAL_RUN_NUMBER: ${{ github.run_number }}
APPROVAL_RUN_ATTEMPT: ${{ github.run_attempt }}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}
11 changes: 10 additions & 1 deletion .github/workflows/pr-auto-assign.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pr-auto-assign
on:
pull_request:
pull_request_target:
types: [opened]

permissions:
Expand All @@ -11,14 +11,20 @@ jobs:
assign:
runs-on: ubuntu-latest
steps:
- name: Skip Dependabot pull requests
if: ${{github.actor == 'dependabot[bot]'}}
run: echo "Dependabot pull requests are handled by dependabot-auto-merge."

- name: Verify bot identity
if: ${{github.actor != 'dependabot[bot]'}}
run: |
BOT_LOGIN="$(gh api user --jq .login)"
test "$BOT_LOGIN" = "eplus-bot"
env:
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Upsert welcome comment
if: ${{github.actor != 'dependabot[bot]'}}
run: |
COMMENT_ID="$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \
--paginate \
Expand Down Expand Up @@ -48,6 +54,7 @@ jobs:
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Add pull request labels
if: ${{github.actor != 'dependabot[bot]'}}
run: |
add_label() {
local name="$1"
Expand Down Expand Up @@ -96,13 +103,15 @@ jobs:
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Assign PR author
if: ${{github.actor != 'dependabot[bot]'}}
run: gh pr edit "$PR_NUMBER" --add-assignee "$PR_AUTHOR" --repo "$GITHUB_REPOSITORY"
env:
PR_NUMBER: ${{github.event.pull_request.number}}
PR_AUTHOR: ${{github.event.pull_request.user.login}}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Request eplus-bot review
if: ${{github.actor != 'dependabot[bot]'}}
run: gh pr edit "$PR_NUMBER" --add-reviewer eplus-bot --repo "$GITHUB_REPOSITORY"
env:
PR_NUMBER: ${{github.event.pull_request.number}}
Expand Down
1 change: 1 addition & 0 deletions entrypoints/popup/components/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface ToggleProps {
description?: string;
}

/** Labeled switch row used by popup settings. */
export default function Toggle({
enabled,
onChange,
Expand Down