CI: Don't run git commands if not run on ci

This commit is contained in:
tt2468 2021-04-28 16:04:26 -07:00
parent c73f6608b9
commit 06857e58ea
2 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,7 @@ jobs:
env:
CHECKOUT_REF: ${{ github.ref }}
GH_TOKEN: ${{ github.token }}
IS_CI: "true"
steps:
- name: 'Checkout'
uses: actions/checkout@v2

View File

@ -18,6 +18,11 @@ if git diff --quiet; then
exit 0
fi
# Exit if we aren't a CI run to prevent messing with the current git config
if [ -z "${IS_CI}" ]; then
exit 0
fi
REMOTE_URL="$(git config remote.origin.url)"
TARGET_REPO=${REMOTE_URL/https:\/\/github.com\//github.com/}
GITHUB_REPO=https://${GH_TOKEN:-git}@${TARGET_REPO}