-
Notifications
You must be signed in to change notification settings - Fork 199
95 lines (81 loc) · 3.07 KB
/
add-orbit-chain.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Add Orbit Chain
on:
workflow_dispatch:
inputs:
issue_number:
description: 'Issue Number'
required: true
type: string
permissions:
issues: read
contents: write
pull-requests: write
jobs:
add_orbit_chain:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'yarn'
- name: Install node_modules
uses: OffchainLabs/actions/node-modules/install@main
- name: Build scripts
run: yarn workspace scripts build
- name: Get issue details
id: issue
uses: actions/github-script@v7
with:
script: |
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: parseInt(process.env.ISSUE_NUMBER)
});
const chainName = issue.data.title.match(/Add Orbit chain\s+(\S+)/i)?.[1] || 'Orbit chain';
return chainName;
result-encoding: string
env:
ISSUE_NUMBER: ${{ inputs.issue_number }}
- name: Generate branch name
id: branch
run: |
timestamp=$(date +%s)
echo "name=feat/add-orbit-chain-${{ inputs.issue_number }}-${timestamp}" >> $GITHUB_OUTPUT
- name: Setup git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Create branch
run: git checkout -b ${{ steps.branch.outputs.name }}
- name: Run addOrbitChain script
run: yarn workspace scripts add-orbit-chain ../../packages/arb-token-bridge-ui/src/util/orbitChainsData.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number || inputs.issue_number }}
NEXT_PUBLIC_INFURA_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY }}
NEXT_PUBLIC_INFURA_KEY_HOLESKY: ${{ secrets.NEXT_PUBLIC_INFURA_KEY_HOLESKY }}
- name: Format files
run: yarn prettier --write "packages/arb-token-bridge-ui/src/**/*.{ts,tsx,js,jsx,json}"
- name: Commit changes
run: |
git add packages/arb-token-bridge-ui/src/**/*
git add packages/arb-token-bridge-ui/public/**/*
git status
git commit -m "feat: add ${{ steps.issue.outputs.result }}"
git push origin ${{ steps.branch.outputs.name }}
- name: Create Pull Request
run: |
gh pr create \
--title "feat: add Orbit chain ${{ steps.issue.outputs.result }}" \
--body "Automated pull request to add ${{ steps.issue.outputs.result }} to the bridge. Closes #${{ inputs.issue_number }}" \
--base master \
--head ${{ steps.branch.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}