Add Orbit Chain #62
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
- 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 (.*?) to/i)?.[1] || 'Orbit chain'; | |
return chainName; | |
result-encoding: string | |
env: | |
ISSUE_NUMBER: ${{ inputs.issue_number }} | |
- name: Create branch | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout -b feat/add-orbit-chain-${{ inputs.issue_number }} | |
- 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 . | |
git commit -m "feat: add ${{ steps.issue.outputs.result }}" | |
git push origin feat/add-orbit-chain-${{ inputs.issue_number }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "feat: add ${{ steps.issue.outputs.result }}" | |
title: "feat: add ${{ steps.issue.outputs.result }}" | |
body: "Automated pull request to add ${{ steps.issue.outputs.result }} to the bridge. Closes #${{ inputs.issue_number }}" | |
branch: feat/add-orbit-chain-${{ inputs.issue_number }} | |
base: main | |
delete-branch: true |