From 848e9cf058afff821ac2d74515bfdf01614b23e4 Mon Sep 17 00:00:00 2001 From: bestony Date: Sat, 16 Jan 2021 15:56:38 +0800 Subject: [PATCH] feat: use github variable --- .github/workflows/lctt-article-badge.yml | 9 --------- .github/workflows/lctt-article-checker.yml | 9 +-------- .github/workflows/lctt-article-status.yml | 9 --------- scripts/check/collect.sh | 4 ++-- 4 files changed, 3 insertions(+), 28 deletions(-) diff --git a/.github/workflows/lctt-article-badge.yml b/.github/workflows/lctt-article-badge.yml index a78d6ed405..aef3d9613d 100644 --- a/.github/workflows/lctt-article-badge.yml +++ b/.github/workflows/lctt-article-badge.yml @@ -6,16 +6,7 @@ on: jobs: build: runs-on: ubuntu-latest - env: - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_BRANCH: master - TRAVIS_PULL_REQUEST: ${{ github.event.number }} - ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: - - name: Set ENV variables - run: | - echo "::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}" - echo "::set-env name=TRAVIS_EVENT_TYPE::$(if [ "schedule" == "${{ github.event_name }}" ]; then echo "cron"; else echo "${{ github.event_name }}"; fi)" - uses: actions/checkout@v2 with: fetch-depth: 0 diff --git a/.github/workflows/lctt-article-checker.yml b/.github/workflows/lctt-article-checker.yml index 7330966b93..87fe19c4ac 100644 --- a/.github/workflows/lctt-article-checker.yml +++ b/.github/workflows/lctt-article-checker.yml @@ -7,15 +7,8 @@ jobs: build: runs-on: ubuntu-latest env: - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_BRANCH: master - TRAVIS_PULL_REQUEST: ${{ github.event.number }} - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + PULL_REQUEST_ID: ${{ github.event.number }} steps: - - name: Set ENV variables - run: | - echo "::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}" - echo "::set-env name=TRAVIS_EVENT_TYPE::$(if [ "schedule" == "${{ github.event_name }}" ]; then echo "cron"; else echo "${{ github.event_name }}"; fi)" - uses: actions/checkout@v2 with: fetch-depth: 0 diff --git a/.github/workflows/lctt-article-status.yml b/.github/workflows/lctt-article-status.yml index ecbe8bcb85..69ac7d5be8 100644 --- a/.github/workflows/lctt-article-status.yml +++ b/.github/workflows/lctt-article-status.yml @@ -7,16 +7,7 @@ on: jobs: build: runs-on: ubuntu-latest - env: - TRAVIS_REPO_SLUG: ${{ github.repository }} - TRAVIS_BRANCH: master - TRAVIS_PULL_REQUEST: ${{ github.event.number }} - ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: - - name: Set ENV variables - run: | - echo "::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}" - echo "::set-env name=TRAVIS_EVENT_TYPE::$(if [ "schedule" == "${{ github.event_name }}" ]; then echo "cron"; else echo "${{ github.event_name }}"; fi)" - uses: actions/checkout@v2 with: fetch-depth: 0 diff --git a/scripts/check/collect.sh b/scripts/check/collect.sh index 3f8e0f0388..fdfb32bc01 100644 --- a/scripts/check/collect.sh +++ b/scripts/check/collect.sh @@ -11,11 +11,11 @@ set -e echo "[收集] 计算 PR 分支与目标分支的分叉点……" -TARGET_BRANCH="${TRAVIS_BRANCH:-master}" +TARGET_BRANCH="${GITHUB_BASE_REF:-master}" echo "[收集] 目标分支设定为:${TARGET_BRANCH}" MERGE_BASE='HEAD^' -[ "$TRAVIS_PULL_REQUEST" != 'false' ] \ +[ "$PULL_REQUEST_ID" != 'false' ] \ && MERGE_BASE="$(git merge-base "$TARGET_BRANCH" HEAD)" echo "[收集] 找到分叉节点:${MERGE_BASE}"