7
7
types : [opened, synchronize, reopened, closed]
8
8
9
9
env :
10
- GITHUB_BOT_NAME : ' github-actions[bot]'
11
- GITHUB_BOT_EMAIL : ' github-actions[bot]@users.noreply.github.com'
10
+ GH_BOT_NAME : ' github-actions[bot]'
11
+ GH_BOT_EMAIL : ' github-actions[bot]@users.noreply.github.com'
12
+ GH_EVENT_OPEN_PR_UPSTREAM : ${{ github.event_name == 'pull_request' && github.event.action != 'closed' &&
13
+ github.event.pull_request && !github.event.pull_request.head.repo.fork }}
14
+ GH_EVENT_PUSH_UPSTREAM : ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' &&
15
+ github.event.ref == 'refs/heads/master' && github.event.repository && !github.event.repository.fork }}
12
16
PUBLISH_DIR : doc/_build/html/
13
17
14
18
defaults :
@@ -130,26 +134,22 @@ jobs:
130
134
run : cp -r dpnp/backend/doc/html ${{ env.PUBLISH_DIR }}/backend_doc
131
135
132
136
# https://github.com/marketplace/actions/github-pages-action
133
- # The step is only used to build docs while pushing PR to "master"
137
+ # The step is only used to build docs while pushing a PR to "master"
134
138
- name : Deploy docs
135
- if : |
136
- github.ref == 'refs/heads/master' && github.event_name == 'push' &&
137
- github.event.ref == 'refs/heads/master' && github.event.repository && !github.event.repository.fork
139
+ if : env.GH_EVENT_PUSH_UPSTREAM
138
140
139
141
with :
140
142
github_token : ${{ secrets.GITHUB_TOKEN }}
141
143
publish_dir : ${{ env.PUBLISH_DIR }}
142
144
keep_files : true
143
145
commit_message : ${{ github.event.head_commit.message }}
144
146
publish_branch : gh-pages
145
- user_name : ${{ env.GITHUB_BOT_NAME }}
146
- user_email : ${{ env.GITHUB_BOT_EMAIL }}
147
+ user_name : ${{ env.GH_BOT_NAME }}
148
+ user_email : ${{ env.GH_BOT_EMAIL }}
147
149
148
150
# The step is only used to build docs while pushing to PR branch
149
151
- name : Publish pull-request docs
150
- if : |
151
- github.event_name == 'pull_request' && github.event.action != 'closed' &&
152
- github.event.pull_request && !github.event.pull_request.head.repo.fork
152
+ if : env.GH_EVENT_OPEN_PR_UPSTREAM
153
153
154
154
with :
155
155
github_token : ${{ secrets.GITHUB_TOKEN }}
@@ -159,14 +159,12 @@ jobs:
159
159
keep_files : true
160
160
commit_message : ${{ github.event.pull_request.title }}
161
161
publish_branch : gh-pages
162
- user_name : ${{ env.GITHUB_BOT_NAME }}
163
- user_email : ${{ env.GITHUB_BOT_EMAIL }}
162
+ user_name : ${{ env.GH_BOT_NAME }}
163
+ user_email : ${{ env.GH_BOT_EMAIL }}
164
164
165
165
# The step is only used to build docs while pushing to PR branch
166
166
- name : Comment with URL to published pull-request docs
167
- if : |
168
- github.event_name == 'pull_request' && github.event.action != 'closed' &&
169
- github.event.pull_request && !github.event.pull_request.head.repo.fork
167
+ if : env.GH_EVENT_OPEN_PR_UPSTREAM
170
168
env :
171
169
PR_NUM : ${{ github.event.number }}
172
170
@@ -199,8 +197,8 @@ jobs:
199
197
git checkout --track tokened_docs/gh-pages
200
198
echo `pwd`
201
199
[ -d pull/${PR_NUM} ] && git rm -rf pull/${PR_NUM}
202
- git config --global user.name ${{ env.GITHUB_BOT_NAME }}
203
- git config --global user.email ${{ env.GITHUB_BOT_EMAIL }}
200
+ git config --global user.name ${{ env.GH_BOT_NAME }}
201
+ git config --global user.email ${{ env.GH_BOT_EMAIL }}
204
202
git commit -m "Removing docs for closed pull request ${PR_NUM}"
205
203
git push tokened_docs gh-pages
206
204
0 commit comments