From 612363904ca28ea96f5c0c275b8afd20707dcf0f Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sat, 4 Jan 2020 00:22:15 -0600 Subject: [PATCH] Set ErrorActionPreference --- .github/workflows/docs.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 597cfa05..0dfa086b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,11 +24,6 @@ jobs: uses: actions/checkout@v2 - name: Checkout submodules run: git submodule update --init --recursive - - name: Set branch name variable - shell: powershell - run: | - $env:BRANCH_NAME = (git rev-parse --abbrev-ref $env:GITHUB_REF) -join "" - echo $env:BRANCH_NAME - name: Locate MSBuild uses: warrenbuckley/Setup-MSBuild@v1 - name: Setup Nuget @@ -48,7 +43,6 @@ jobs: if ($lastexitcode -ne 0){ throw [System.Exception] "docfx build failed with exit code $lastexitcode." } - echo $env:BRANCH_NAME - name: Checkout current pages uses: actions/checkout@v2 with: @@ -64,13 +58,14 @@ jobs: Move-Item "$env:ORIGIN_SITE/$env:BRANCH_DIR" _site cd _site + $ErrorActionPreference = "SilentlyContinue" git add -A 2>&1 $srcMessage = (git show -s --format=%B $env:GITHUB_SHA) -join "`n" git commit -q -a -m "Generated Docs -- $srcMessage" git push -q origin gh-pages - if: env.BRANCH_NAME == 'master' + if: github.ref == 'refs/heads/master' - name: Publish branch site to GitHub pages shell: powershell working-directory: ./docs/${{ env.ORIGIN_SITE }} @@ -78,7 +73,8 @@ jobs: if (-Not (Test-Path $env:BRANCH_DIR)) { New-Item -ItemType directory -Path $env:BRANCH_DIR } - $branchPath = "$env:BRANCH_DIR/$env:BRANCH_NAME" + $branchName = (git rev-parse --abbrev-ref $env:GITHUB_REF) -join "" + $branchPath = "$env:BRANCH_DIR/$branchName" if (Test-Path $branchPath) { # force remove it @@ -89,10 +85,11 @@ jobs: # move generated into place Move-Item ../_site $branchPath + $ErrorActionPreference = "SilentlyContinue" git add -A 2>&1 $srcMessage = (git show -s --format=%B $env:GITHUB_SHA) -join "`n" - git commit -q -a -m "Generated Docs ($env:BRANCH_NAME) -- $srcMessage" + git commit -q -a -m "Generated Docs ($branchName) -- $srcMessage" git push -q origin gh-pages - if: env.BRANCH_NAME != 'master' + if: github.ref != 'refs/heads/master'