Skip to content

import class with same name complete #941

import class with same name complete

import class with same name complete #941

Workflow file for this run

name: check
on:
pull_request_target:
branches:
- main
jobs:
check:
runs-on: 'ubuntu-latest'
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
ref: main
fetch-depth: 0
- name: Validate PR branch name
uses: actions/github-script@v5
with:
script: |
const branchName = context.payload.pull_request.head.ref;
if (!/^[\w/-]*$/.test(branchName)) {
throw new Error(`Invalid branch name: ${branchName}`);
}
- name: Checkout PR branch
run: |
git remote add pr ${{ github.event.pull_request.head.repo.html_url }}
git fetch pr
git switch -c pr/${{ github.event.pull_request.head.ref }} pr/${{ github.event.pull_request.head.ref }}
- name: Determine player username
id: determine-player-username
uses: actions/github-script@v5
with:
script: |
if (!context.payload.pull_request.head.repo.fork && context.payload.pull_request.head.ref.startsWith('gh/')) {
core.setOutput('player-github-username', context.payload.pull_request.head.ref.substring(3).split('/')[0])
} else {
core.setOutput('player-github-username', context.payload.pull_request.user.login)
}
- name: Base64 encode PR title
id: encode-pr-title
uses: actions/github-script@v5
with:
script: |
const title = context.payload.pull_request.title;
const encodedTitle = Buffer.from(title).toString('base64');
core.setOutput('encoded-title', encodedTitle);
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Check Problems in Code
run: >
curl --location --fail --silent --show-error -o code-checker.jar https://github.com/ByteLegend/tools/releases/download/v1.0.0/code-checker.jar &&
java
-DgitHubToken=${{ secrets.GITHUB_TOKEN }}
-DprRepoFullName=${{ github.event.pull_request.base.repo.full_name }}
-DprLocalBranch=pr/${{ github.event.pull_request.head.ref }}
-DprAuthor=${{ steps.determine-player-username.outputs.player-github-username }}
-DprNumber=${{ github.event.pull_request.number }}
-DprTitleEncoded=${{ steps.encode-pr-title.outputs.encoded-title }}
-DprHeadSha=${{ github.event.pull_request.head.sha }}
-DapiUrl=https://bytelegend.com
-DcodeCheckerSecret=${{ secrets.CODE_CHECKER_SECRET }}
-DinternalApiSecret=${{ secrets.INTERNAL_API_SECRET }}
-jar code-checker.jar
- name: Verify
run: mvn clean verify
- name: Merge and Revert
run: >
curl --location --fail --silent --show-error -o code-merger.jar https://github.com/ByteLegend/tools/releases/download/v1.0.0/code-merger.jar &&
java
-DgitHubToken=${{ secrets.BYTELEGENDBOT_TOKEN }}
-DprRepoFullName=${{ github.event.pull_request.base.repo.full_name }}
-DprLocalBranch=pr/${{ github.event.pull_request.head.ref }}
-DprAuthor=${{ steps.determine-player-username.outputs.player-github-username }}
-DprNumber=${{ github.event.pull_request.number }}
-DprTitleEncoded=${{ steps.encode-pr-title.outputs.encoded-title }}
-DprHeadSha=${{ github.event.pull_request.head.sha }}
-DpushUrl=https://${{ secrets.BYTELEGENDBOT_TOKEN }}@github.com/${{ github.event.pull_request.base.repo.full_name }}.git
-jar code-merger.jar