feat: Tron support #3
This file contains 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: cicd-trigger-by-comment | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
pre-check: | |
runs-on: ubuntu-latest | |
if: github.repository == 'bnb-chain/canonical-bridge' && contains(github.event.comment.body, '/qa-deploy') | |
outputs: | |
codeowners: ${{ steps.codeowners.outputs.content }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Read codeowners | |
id: codeowners | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: .github/CODEOWNERS | |
cicd: | |
needs: [pre-check] | |
if: contains(needs.pre-check.outputs.codeowners, github.event.comment.user.login) | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v3 | |
id: get-pr | |
with: | |
script: | | |
const request = { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
} | |
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) | |
try { | |
const result = await github.pulls.get(request) | |
return result.data | |
} catch (err) { | |
core.setFailed(`Request failed with error ${err}`) | |
} | |
- name: get pr env | |
id: pr-env | |
run: | | |
BRANCH_NAME=${{ fromJSON(steps.get-pr.outputs.result).head.ref }} | |
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT | |
- name: get comment | |
id: get-comment | |
run: | | |
#!/bin/bash | |
input_comment="${{ github.event.comment.body }}" | |
comment_format=${input_comment// /} | |
APP_NAME=${comment_format#*:} | |
echo "APP_NAME=${APP_NAME}" >> $GITHUB_OUTPUT | |
- name: Checkout code repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.pr-env.outputs.BRANCH_NAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: ./.github/actions/setup | |
- name: Deploy github pages | |
if: contains(steps.get-comment.outputs.APP_NAME, 'canonical-bridge-ui') | |
uses: ./.github/actions/gh-pages | |
- name: Deploy SDK | |
if: contains(steps.get-comment.outputs.APP_NAME, 'canonical-bridge-sdk') | |
uses: ./.github/actions/alpha | |
with: | |
app-name: ${{steps.get-comment.outputs.APP_NAME}} | |
- name: Deploy Widget | |
if: contains(steps.get-comment.outputs.APP_NAME, 'canonical-bridge-widget') | |
uses: ./.github/actions/alpha | |
with: | |
app-name: ${{steps.get-comment.outputs.APP_NAME}} |