feat: use github variable

This commit is contained in:
bestony 2021-01-16 15:56:38 +08:00
parent d27ea5c8dc
commit 848e9cf058
4 changed files with 3 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}"