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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Briefly describe what this PR changes in Gmail Alias Toolkit. -->

Fixes #
<!-- Fixes # -->

## Type of Change

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: dependabot-auto-merge
on: pull_request_target

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write
contents: write
Expand Down
64 changes: 46 additions & 18 deletions .github/workflows/pr-auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
workflows: [CI]
types: [completed]

concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write
issues: write
Expand Down Expand Up @@ -40,9 +44,32 @@ jobs:
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Wait for pull request checks
run: gh pr checks "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --watch --interval 10
run: |
for attempt in {1..60}; do
CHECKS="$(gh pr checks "$PR_NUMBER" \
--repo "$GITHUB_REPOSITORY" \
--json bucket,name,workflow)"

FAILING_COUNT="$(jq '[.[] | select(.workflow != env.APPROVAL_WORKFLOW and (.bucket == "fail" or .bucket == "cancel"))] | length' <<<"$CHECKS")"
if [ "$FAILING_COUNT" -gt 0 ]; then
jq -r '.[] | select(.workflow != env.APPROVAL_WORKFLOW and (.bucket == "fail" or .bucket == "cancel")) | "::error::\(.workflow): \(.name) failed"' <<<"$CHECKS"
exit 1
fi

PENDING_COUNT="$(jq '[.[] | select(.workflow != env.APPROVAL_WORKFLOW and .bucket == "pending")] | length' <<<"$CHECKS")"
if [ "$PENDING_COUNT" -eq 0 ]; then
exit 0
fi

echo "Waiting for $PENDING_COUNT pull request check(s) before approving (attempt $attempt/60)."
sleep 10
done

echo "::error::Timed out waiting for pull request checks to finish."
exit 1
env:
PR_NUMBER: ${{steps.pr.outputs.number}}
APPROVAL_WORKFLOW: ${{github.workflow}}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Approve pull request
Expand All @@ -53,11 +80,15 @@ jobs:
| tail -n 1)"

if [ -z "$APPROVED_FOR_HEAD" ]; then
gh pr review --approve "$PR_NUMBER" --repo "$GITHUB_REPOSITORY"
gh pr review --approve "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --body "$APPROVAL_REVIEW_BODY"
fi
env:
PR_NUMBER: ${{steps.pr.outputs.number}}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
APPROVAL_REVIEW_BODY: |
Approved by @eplus-bot after all pull request checks passed.

CI run: ${{ github.event.workflow_run.html_url }}
GH_TOKEN: ${{secrets.EPLUS_BOT_TOKEN}}

- name: Upsert CI approval comment
Expand All @@ -81,22 +112,19 @@ jobs:
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
)"

APPROVAL_COMMENT="$(printf '%s\n' \
"$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")"
if [ -n "$COMMENT_ID" ]; then
gh api \
--method PATCH \
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
pull_request_target:
types: [opened]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
issues: write
pull-requests: write
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
types:
- closed

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-release:
name: Build and Release
Expand All @@ -25,18 +29,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v7

- name: Ensure Yarn cache directory exists
run: mkdir -p ~/Library/Caches/Yarn/v6
- name: Enable Corepack
run: corepack enable

- name: Setup Node.js with Yarn cache
uses: actions/setup-node@v6
with:
node-version: 24.x
cache: "yarn"

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install --immutable --mode=skip-build

Expand Down