Skip to content

Commit

Permalink
Test env variables for user name and email in Build docs action
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwolfy committed Nov 28, 2023
1 parent 780d686 commit cd503b4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build-sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ on:
types: [opened, synchronize, reopened, closed]

env:
GITHUB_BOT_NAME: 'github-actions[bot]'
GITHUB_BOT_EMAIL: 'github-actions[bot]@users.noreply.github.com'
PUBLISH_DIR: doc/_build/html/
ACTIVE_PR_NOT_FORK: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request && !github.event.pull_request.head.repo.fork }}

defaults:
run:
Expand All @@ -34,6 +37,9 @@ jobs:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
echo "GITHUB_BOT_NAME=${{ env.GITHUB_BOT_NAME }}"
echo "GITHUB_BOT_EMAIL=${{ env.GITHUB_BOT_EMAIL }}"
echo "ACTIVE_PR_NOT_FORK=${{ env.ACTIVE_PR_NOT_FORK }}"
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
Expand Down Expand Up @@ -136,6 +142,8 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.PUBLISH_DIR }}
user_name: ${{ env.GITHUB_BOT_NAME }}
user_email: ${{ env.GITHUB_BOT_EMAIL }}

- name: Publish pull-request docs
if: |
Expand All @@ -149,8 +157,8 @@ jobs:
keep_files: true
commit_message: ${{ github.event.head_commit.message }}
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
user_name: ${{ env.GITHUB_BOT_NAME }}
user_email: ${{ env.GITHUB_BOT_EMAIL }}

- name: Comment with URL to published pull-request docs
if: |
Expand Down Expand Up @@ -185,8 +193,8 @@ jobs:
git checkout --track tokened_docs/gh-pages
echo `pwd`
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM}
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global user.name ${{ env.GITHUB_BOT_NAME }}
git config --global user.email ${{ env.GITHUB_BOT_EMAIL }}
git commit -m "Removing docs for closed pull request ${PR_NUM}"
git push tokened_docs gh-pages
Expand Down

0 comments on commit cd503b4

Please sign in to comment.