Skip to content

Commit 7be8795

Browse files
hyper-gonk[bot]ltyuXarozchristopherbrummxeno097
authored
chore: merge main into injective (#825)
⚠️ **This PR has merge conflicts that need to be resolved manually.** This PR was automatically created to merge changes from `main` into `injective`. --------- Co-authored-by: Lee <6251863+ltyu@users.noreply.github.com> Co-authored-by: Jason Guo <33064781+Xaroz@users.noreply.github.com> Co-authored-by: Christopher Brumm <97845034+christopherbrumm@users.noreply.github.com> Co-authored-by: xeno097 <xeno097.cp@gmail.com> Co-authored-by: ljankovic-txfusion <131957285+ljankovic-txfusion@users.noreply.github.com> Co-authored-by: -f <kunalarora1729@gmail.com> Co-authored-by: Xaroz <jasonguo2013jg@gmail.com> Co-authored-by: Troy Kessler <43882936+troykessler@users.noreply.github.com> Co-authored-by: Andrey Taranov <86911+antigremlin@users.noreply.github.com> Co-authored-by: Jean Cvllr <31145285+CJ42@users.noreply.github.com> Co-authored-by: default <b00ste.lyx@gmail.com> Co-authored-by: Jamin <57451149+yjamin@users.noreply.github.com> Co-authored-by: Troy Kessler <troy.kessler99@gmail.com> Co-authored-by: Olexandr88 <radole1203@gmail.com> Co-authored-by: Paul Balaji <10051819+paulbalaji@users.noreply.github.com> Co-authored-by: Sina Pilehchiha <sina.pilehchiha@gmail.com> Co-authored-by: Nam Chu Hoai <nambrot@googlemail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: hyper-gonk[bot] <246310972+hyper-gonk[bot]@users.noreply.github.com>
1 parent cd7061f commit 7be8795

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+27455
-28667
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,28 @@ jobs:
1515
install:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/cache@v3
18+
- uses: actions/checkout@v6
19+
- uses: pnpm/action-setup@v4
20+
- uses: actions/setup-node@v6
2021
with:
21-
path: |
22-
**/node_modules
23-
.yarn/cache
24-
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
25-
- name: yarn-install
26-
# Check out the lockfile from main, reinstall, and then
27-
# verify the lockfile matches what was committed.
22+
node-version-file: 'package.json'
23+
24+
- name: Get pnpm store directory
25+
id: pnpm-store
26+
shell: bash
27+
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT
28+
29+
- name: Cache pnpm store
30+
uses: actions/cache@v4
31+
with:
32+
path: ${{ steps.pnpm-store.outputs.path }}
33+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-
36+
37+
- name: pnpm-install
2838
run: |
29-
yarn install
39+
pnpm install --frozen-lockfile
3040
CHANGES=$(git status -s)
3141
if [[ ! -z $CHANGES ]]; then
3242
echo "Changes found: $CHANGES"
@@ -38,32 +48,62 @@ jobs:
3848
runs-on: ubuntu-latest
3949
needs: [install]
4050
steps:
41-
- uses: actions/checkout@v3
42-
- uses: actions/cache@v3
51+
- uses: actions/checkout@v6
52+
- uses: pnpm/action-setup@v4
53+
- uses: actions/setup-node@v6
54+
with:
55+
node-version-file: 'package.json'
56+
57+
- name: Get pnpm store directory
58+
id: pnpm-store
59+
shell: bash
60+
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT
61+
62+
- name: Cache pnpm store
63+
uses: actions/cache@v4
4364
with:
44-
path: |
45-
**/node_modules
46-
.yarn/cache
47-
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
65+
path: ${{ steps.pnpm-store.outputs.path }}
66+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
67+
restore-keys: |
68+
${{ runner.os }}-pnpm-store-
69+
70+
- name: Install dependencies
71+
run: pnpm install --frozen-lockfile
72+
4873
- name: build
49-
run: yarn run build
74+
run: pnpm run build
5075
env:
5176
NEXT_PUBLIC_WALLET_CONNECT_ID: ${{ secrets.NEXT_PUBLIC_WALLET_CONNECT_ID }}
5277

5378
prettier:
5479
runs-on: ubuntu-latest
5580
needs: [install]
5681
steps:
57-
- uses: actions/checkout@v3
58-
- uses: actions/cache@v3
82+
- uses: actions/checkout@v6
83+
- uses: pnpm/action-setup@v4
84+
- uses: actions/setup-node@v6
85+
with:
86+
node-version-file: 'package.json'
87+
88+
- name: Get pnpm store directory
89+
id: pnpm-store
90+
shell: bash
91+
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT
92+
93+
- name: Cache pnpm store
94+
uses: actions/cache@v4
5995
with:
60-
path: |
61-
**/node_modules
62-
.yarn/cache
63-
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
96+
path: ${{ steps.pnpm-store.outputs.path }}
97+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
98+
restore-keys: |
99+
${{ runner.os }}-pnpm-store-
100+
101+
- name: Install dependencies
102+
run: pnpm install --frozen-lockfile
103+
64104
- name: prettier
65105
run: |
66-
yarn run prettier
106+
pnpm run prettier
67107
CHANGES=$(git status -s)
68108
if [[ ! -z $CHANGES ]]; then
69109
echo "Changes found: $CHANGES"
@@ -74,26 +114,56 @@ jobs:
74114
runs-on: ubuntu-latest
75115
needs: [install]
76116
steps:
77-
- uses: actions/checkout@v3
78-
- uses: actions/cache@v3
117+
- uses: actions/checkout@v6
118+
- uses: pnpm/action-setup@v4
119+
- uses: actions/setup-node@v6
120+
with:
121+
node-version-file: 'package.json'
122+
123+
- name: Get pnpm store directory
124+
id: pnpm-store
125+
shell: bash
126+
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT
127+
128+
- name: Cache pnpm store
129+
uses: actions/cache@v4
79130
with:
80-
path: |
81-
**/node_modules
82-
.yarn/cache
83-
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
131+
path: ${{ steps.pnpm-store.outputs.path }}
132+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
133+
restore-keys: |
134+
${{ runner.os }}-pnpm-store-
135+
136+
- name: Install dependencies
137+
run: pnpm install --frozen-lockfile
138+
84139
- name: lint
85-
run: yarn run lint
140+
run: pnpm run lint
86141

87142
test:
88143
runs-on: ubuntu-latest
89144
needs: [build]
90145
steps:
91-
- uses: actions/checkout@v3
92-
- uses: actions/cache@v3
146+
- uses: actions/checkout@v6
147+
- uses: pnpm/action-setup@v4
148+
- uses: actions/setup-node@v6
149+
with:
150+
node-version-file: 'package.json'
151+
152+
- name: Get pnpm store directory
153+
id: pnpm-store
154+
shell: bash
155+
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT
156+
157+
- name: Cache pnpm store
158+
uses: actions/cache@v4
93159
with:
94-
path: |
95-
**/node_modules
96-
.yarn/cache
97-
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
160+
path: ${{ steps.pnpm-store.outputs.path }}
161+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
162+
restore-keys: |
163+
${{ runner.os }}-pnpm-store-
164+
165+
- name: Install dependencies
166+
run: pnpm install --frozen-lockfile
167+
98168
- name: test
99-
run: yarn run test
169+
run: pnpm run test

.github/workflows/create-merge-prs.yaml

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,104 @@ on:
44
push:
55
branches:
66
- main
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
712

813
jobs:
914
create-merge-prs:
1015
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
1119
strategy:
1220
fail-fast: false
1321
matrix:
14-
name: [injective, nexus, trump, ousdt]
22+
branch: [injective, nexus, trump, ousdt]
1523
steps:
24+
- name: Generate GitHub App Token
25+
id: generate-token
26+
uses: actions/create-github-app-token@v2
27+
with:
28+
app-id: ${{ secrets.HYPER_GONK_APP_ID }}
29+
private-key: ${{ secrets.HYPER_GONK_PRIVATE_KEY }}
30+
1631
- name: Checkout repository
17-
uses: actions/checkout@v3
32+
uses: actions/checkout@v5
1833
with:
1934
fetch-depth: 0
35+
token: ${{ steps.generate-token.outputs.token }}
36+
37+
- name: Get GitHub App User ID
38+
id: get-user-id
39+
run: echo "user-id=$(gh api /users/${{ steps.generate-token.outputs.app-slug }}[bot] --jq .id)" >> "$GITHUB_OUTPUT"
40+
env:
41+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
2042

21-
- name: Configure Git
43+
- name: Configure Git for Hyper Gonk
2244
run: |
23-
git config user.name "GitHub Actions Bot"
24-
git config user.email "github-actions[bot]@users.noreply.github.com"
45+
git config user.name "${{ steps.generate-token.outputs.app-slug }}[bot]"
46+
git config user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.generate-token.outputs.app-slug }}[bot]@users.noreply.github.com"
47+
48+
- name: Check if merge is needed
49+
id: check-merge
50+
run: |
51+
git fetch origin ${{ matrix.branch }}
52+
if git merge-base --is-ancestor origin/main origin/${{ matrix.branch }}; then
53+
echo "Branch ${{ matrix.branch }} is already up-to-date with main"
54+
echo "needs_merge=false" >> $GITHUB_OUTPUT
55+
else
56+
echo "Branch ${{ matrix.branch }} needs updates from main"
57+
echo "needs_merge=true" >> $GITHUB_OUTPUT
58+
fi
2559
2660
- name: Create and push merge branch
61+
if: steps.check-merge.outputs.needs_merge == 'true'
62+
id: merge
2763
run: |
28-
git checkout ${{ matrix.name }}
29-
git merge origin/main
30-
git checkout -b main-to-${{ matrix.name }}
31-
git push -fu origin main-to-${{ matrix.name }}
64+
git checkout ${{ matrix.branch }}
3265
33-
- name: Check and Create Pull Request
66+
# Attempt merge, capturing if there are conflicts
67+
if git merge origin/main --no-edit; then
68+
echo "has_conflicts=false" >> $GITHUB_OUTPUT
69+
else
70+
echo "::warning::Merge conflict detected for ${{ matrix.branch }}"
71+
echo "has_conflicts=true" >> $GITHUB_OUTPUT
72+
# Stage all files including conflicts to allow branch creation
73+
git add -A
74+
git commit --no-edit || true
75+
fi
76+
77+
git branch -M main-to-${{ matrix.branch }}
78+
git push -fu origin main-to-${{ matrix.branch }}
3479
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
81+
82+
- name: Create or update PR
83+
if: steps.check-merge.outputs.needs_merge == 'true'
3684
run: |
37-
PR_EXISTS=$(gh pr list --base ${{ matrix.name }} --head main-to-${{ matrix.name }} --json number --jq length)
38-
if [ "$PR_EXISTS" -eq "0" ]; then
85+
PR_EXISTS=$(gh pr list --base ${{ matrix.branch }} --head main-to-${{ matrix.branch }} --json number --jq '.[0].number')
86+
87+
if [ "${{ steps.merge.outputs.has_conflicts }}" == "true" ]; then
88+
BODY="⚠️ **This PR has merge conflicts that need to be resolved manually.**
89+
90+
This PR was automatically created to merge changes from \`main\` into \`${{ matrix.branch }}\`."
91+
else
92+
BODY="This PR was automatically created to merge changes from \`main\` into \`${{ matrix.branch }}\`."
93+
fi
94+
95+
if [ -z "$PR_EXISTS" ]; then
3996
gh pr create \
40-
--base ${{ matrix.name }} \
41-
--head main-to-${{ matrix.name }} \
42-
--title "chore: merge main into ${{ matrix.name }}" \
43-
--body "This PR was automatically created to merge changes from \`main\` into \`${{ matrix.name }}\`." \
97+
--base ${{ matrix.branch }} \
98+
--head main-to-${{ matrix.branch }} \
99+
--title "chore: merge main into ${{ matrix.branch }}" \
100+
--body "$BODY" \
44101
--draft
102+
echo "Created new PR for ${{ matrix.branch }}"
45103
else
46-
echo "Pull request already exists. Skipping creation."
104+
echo "PR #$PR_EXISTS already exists for ${{ matrix.branch }}"
47105
fi
106+
env:
107+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

0 commit comments

Comments
 (0)