From 57fd7ca34cc37db5713c9a95bf37c35f1149f4ec Mon Sep 17 00:00:00 2001 From: ZehuaCao <47251317+Romanticoseu@users.noreply.github.com> Date: Tue, 13 Sep 2022 10:38:31 +0800 Subject: [PATCH] Modify two errors in create-job-badge and license-scan workflow. (#5718) * add create-job-status-badge action * add selfHostedRunner input * add create badge job * change isSelfHostedRunner to is-self-hosted-runner * update create-job-status-badge * adjust indent --- .../create-job-status-badge/action.yml | 10 +++- .github/workflows/license-scan.yml | 48 +++++++++---------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/actions/create-job-status-badge/action.yml b/.github/actions/create-job-status-badge/action.yml index b98995e54e1..032c14f2a70 100644 --- a/.github/actions/create-job-status-badge/action.yml +++ b/.github/actions/create-job-status-badge/action.yml @@ -37,7 +37,7 @@ runs: run: if [ ${{ env.JOB-STATUS }} == "success" ] ; then echo "COLOR=green" >> $GITHUB_ENV ; else echo "COLOR=red" >> $GITHUB_ENV; fi - name: Create job badge - if: ${{ inputs.type == 'job' }} + if: ${{ inputs.type == 'job' && inputs.secret != '' }} uses: analytics-zoo/dynamic-badges-action@master with: auth: ${{ inputs.secret }} @@ -49,7 +49,7 @@ runs: color: ${{ env.COLOR }} - name: Create time badge - if: ${{ inputs.type == 'workflow' }} + if: ${{ inputs.type == 'workflow' && inputs.secret != '' }} uses: analytics-zoo/dynamic-badges-action@master with: auth: ${{ inputs.secret }} @@ -58,3 +58,9 @@ runs: filename: ${{ inputs.file-name }} label: Time is message: ${{ env.TIME }} + + - name: print error message + if: ${{ inputs.secret == '' }} + shell: bash + run: | + echo "Can not get secret! Please check out your workflow!(mainly caused by pr trigger)" diff --git a/.github/workflows/license-scan.yml b/.github/workflows/license-scan.yml index a497f106b0e..cb7367ecaa6 100644 --- a/.github/workflows/license-scan.yml +++ b/.github/workflows/license-scan.yml @@ -15,21 +15,21 @@ jobs: fossa-scan: runs-on: ubuntu-latest steps: - - name: "Checkout Code" - uses: actions/checkout@v3 + - name: "Checkout Code" + uses: actions/checkout@v3 - - name: "Run FOSSA Scan" - uses: fossas/fossa-action@main # Use a specific version if locking is preferred - with: - api-key: ${{ secrets.FOSSAAPIKEY }} - - - name: "Run FOSSA Test" - uses: fossas/fossa-action@main # Use a specific version if locking is preferred - with: - api-key: ${{ secrets.FOSSAAPIKEY }} - run-tests: true - - - name: "Filter the Dependency Tree" + - name: "Run FOSSA Scan" + uses: fossas/fossa-action@main # Use a specific version if locking is preferred + with: + api-key: ${{ secrets.FOSSAAPIKEY }} + + - name: "Run FOSSA Test" + uses: fossas/fossa-action@main # Use a specific version if locking is preferred + with: + api-key: ${{ secrets.FOSSAAPIKEY }} + run-tests: true + + - name: "Filter the Dependency Tree" if: ${{ failure() }} run: | sed -i 's/${spark-version.project}<\/artifactId>/${spark-version.project}-${SPARK_PLATFORM}<\/artifactId>/' scala/dllib/pom.xml @@ -47,16 +47,16 @@ jobs: cd scala mvn -P spark_3.x dependency:tree -Dspark.version=3.1.2 -DSPARK_PLATFORM=SPARK_3.1 - - name: Create Job Badge - if: ${{ always() }} - uses: ./.github/actions/create-job-status-badge - with: - secret: ${{ secrets.GIST_SECRET }} - gist-id: f91eb10af4d9dbe216ba0f0da71cace9 - is-self-hosted-runner: false - file-name: fossa-scan.json - type: job - job-name: fossa-scan + - name: Create Job Badge + if: ${{ always() }} + uses: ./.github/actions/create-job-status-badge + with: + secret: ${{ secrets.GIST_SECRET }} + gist-id: f91eb10af4d9dbe216ba0f0da71cace9 + is-self-hosted-runner: false + file-name: fossa-scan.json + type: job + job-name: fossa-scan create-workflow-badge: