Skip to content

Commit 88cb421

Browse files
committed
Configure PR automation and GitHub Pages deploy
1 parent 537d113 commit 88cb421

6 files changed

Lines changed: 218 additions & 30 deletions

File tree

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
labels:
8+
- dependencies
9+
- automerge

.github/pull_request_template.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Summary
2+
3+
-
4+
5+
## Checklist
6+
7+
- [ ] I changed only the files needed for this update.
8+
- [ ] I verified the chain config format.
9+
- [ ] I confirmed public API/RPC endpoints support CORS when required.
10+
- [ ] I added or updated logos under `logos/` when needed.
11+
12+
## Test Result
13+
14+
- [ ] Connect wallet, check if address is correct?
15+
- [ ] Transfer
16+
- [ ] Delegate
17+
- [ ] Redelegate
18+
- [ ] Unbond
19+
- [ ] Withdraw Validator's Commission
20+
- [ ] Withdraw Rewards

.github/workflows/auto-merge.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Auto Merge Pull Requests
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- labeled
7+
- opened
8+
- reopened
9+
- ready_for_review
10+
- synchronize
11+
- review_requested
12+
check_suite:
13+
types: [ completed ]
14+
status: {}
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
checks: read
20+
statuses: read
21+
22+
jobs:
23+
automerge:
24+
name: Auto merge approved PRs
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Auto merge
28+
uses: pascalgn/automerge-action@v0.16.4
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
MERGE_LABELS: automerge
32+
MERGE_METHOD: squash
33+
MERGE_DELETE_BRANCH: true
34+
MERGE_REQUIRED_APPROVALS: 1
35+
MERGE_RETRIES: 6
36+
MERGE_RETRY_SLEEP: 10000

.github/workflows/deploy.yaml

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,69 @@
11

2-
name: Deploy to ping.pub
2+
name: Deploy to GitHub Pages
33

44
on:
55
push:
66
branches: [ main ]
7-
# pull_request:
8-
# branches: [ master ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
917

1018
jobs:
19+
build:
20+
name: Build site
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Git Checkout Latest
24+
uses: actions/checkout@v4
25+
with:
26+
submodules: recursive
27+
28+
- name: Setup Pages
29+
uses: actions/configure-pages@v5
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 18
35+
cache: yarn
36+
cache-dependency-path: explorer/yarn.lock
37+
38+
- name: Setup config
39+
run: cp -rf chains/* explorer/chains/
40+
41+
- name: Install dependencies
42+
working-directory: explorer
43+
run: yarn install --frozen-lockfile
44+
45+
- name: Build
46+
working-directory: explorer
47+
run: yarn build
48+
env:
49+
NODE_OPTIONS: --max_old_space_size=4096
50+
51+
- name: Copy logos
52+
run: cp -rf logos explorer/dist/
53+
54+
- name: Upload Pages artifact
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: explorer/dist
58+
1159
deploy:
12-
name: Ping deploy
13-
runs-on: mainnet
60+
name: Deploy site
61+
needs: build
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
1466
steps:
15-
- name: Environment
16-
run: export NODE_OPTIONS="--max_old_space_size=4096"
17-
18-
- name: Clean Repository
19-
run: rm -rf explorer
20-
21-
- name: Git Checkout Latest
22-
uses: actions/checkout@v4
23-
with:
24-
submodules: recursive
25-
26-
- name: Setup config
27-
run: cp -rf chains/* explorer/chains/
28-
29-
- name: Build
30-
run: cd explorer && yarn && yarn build
31-
32-
- name: copy logos
33-
run: cp -rf logos explorer/dist/
34-
35-
# - name: debug
36-
# run: ls -l explorer/dist/logos
37-
38-
- name: Deploy
39-
run: cp -rf explorer/dist/* /var/www/html/
67+
- name: Deploy to GitHub Pages
68+
id: deployment
69+
uses: actions/deploy-pages@v4

.github/workflows/pr-review.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Pull Request Review
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- 'chains/**'
8+
- 'explorer'
9+
- 'logos/**'
10+
- '.github/workflows/**'
11+
- '.gitmodules'
12+
- 'README.md'
13+
14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
18+
jobs:
19+
config-check:
20+
name: Check blockchain configs
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Git Checkout Latest
24+
uses: actions/checkout@v4
25+
26+
- name: Check Chain Configs
27+
uses: ping-pub/ping-dashboard-config-checker@v1.0
28+
29+
build:
30+
name: Build explorer
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Git Checkout Latest
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: recursive
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 18
42+
cache: yarn
43+
cache-dependency-path: explorer/yarn.lock
44+
45+
- name: Setup config
46+
run: cp -rf chains/* explorer/chains/
47+
48+
- name: Install dependencies
49+
working-directory: explorer
50+
run: yarn install --frozen-lockfile
51+
52+
- name: Build
53+
working-directory: explorer
54+
run: yarn build
55+
env:
56+
NODE_OPTIONS: --max_old_space_size=4096

docs/github-automation.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# GitHub Automation
2+
3+
This repository publishes the built explorer to GitHub Pages and can automatically merge approved pull requests.
4+
5+
## GitHub Pages
6+
7+
In repository settings:
8+
9+
1. Go to **Settings > Pages**.
10+
2. Set **Build and deployment > Source** to **GitHub Actions**.
11+
3. If `ping.pub` should keep using the custom domain, configure the domain in the same page.
12+
13+
The `Deploy to GitHub Pages` workflow builds the `explorer` submodule, copies this repository's chain configs and logos into the build output, uploads `explorer/dist`, and deploys it through GitHub Pages.
14+
15+
## Pull Request Review
16+
17+
The `Pull Request Review` workflow runs on pull requests that change chain configs, logos, workflows, or repository metadata. It validates chain configs and verifies that the explorer still builds.
18+
19+
Pull requests also use `.github/pull_request_template.md` so contributors provide the same manual test checklist requested in the README.
20+
21+
## Auto Merge
22+
23+
Auto merge is intentionally gated:
24+
25+
- The pull request must have the `automerge` label.
26+
- The pull request must have at least one approval.
27+
- Required branch protection checks must pass.
28+
29+
Recommended branch protection for `main`:
30+
31+
- Require a pull request before merging.
32+
- Require approvals.
33+
- Require status checks to pass before merging.
34+
- Add `Pull Request Review / Check blockchain configs` and `Pull Request Review / Build explorer` as required checks.
35+
- Enable **Allow auto-merge** in **Settings > General**.
36+
37+
To auto merge a pull request, add the `automerge` label after the review requirements are satisfied. The workflow uses squash merge and deletes the source branch after merging.

0 commit comments

Comments
 (0)