From 6aea038a306df4ab81575fe79133e68ef449b2d4 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 16 Sep 2021 12:16:20 -0700 Subject: [PATCH 1/2] Allow manual triggering of gh-action, do not deploy pull requests --- .github/workflows/rust.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f043c5242ce..fe7f1c81ad7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,7 +1,8 @@ name: Rust on: - push: + workflow_dispatch: + push: branches: [ master ] pull_request: branches: [ master ] @@ -21,9 +22,13 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Prepare pages run: ./prepare-pages.sh + - name: Deploy GitHub Pages + # Do not deploy PRs. + if: ${{ github.event_name != 'pull_request' }} run: | git worktree add gh-pages gh-pages git config user.name "Deploy from CI" From e763c51b388625782fde0c6ac0b4aca3508b4dec Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 16 Sep 2021 12:57:04 -0700 Subject: [PATCH 2/2] Use gh-actions account for gh-pages deploy commits --- .github/workflows/rust.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fe7f1c81ad7..823551c46ae 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -31,13 +31,12 @@ jobs: if: ${{ github.event_name != 'pull_request' }} run: | git worktree add gh-pages gh-pages - git config user.name "Deploy from CI" - git config user.email "" cd gh-pages # Delete the ref to avoid keeping history. git update-ref -d refs/heads/gh-pages rm -rf * mv ../output/* . git add . - git commit -m "Deploy $GITHUB_SHA to gh-pages" + git -c 'user.name=github-actions[bot]' -c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \ + commit -m "Deploy $GITHUB_SHA to gh-pages" git push --force