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_PR_UPSTREAM : ${{ github.event_name == 'pull_request' && github.event.pull_request && !github.event.pull_request.head.repo.fork }}
13
+ GH_EVENT_PUSH_UPSTREAM : ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' &&
14
+ github.event.ref == 'refs/heads/master' && github.event.repository && !github.event.repository.fork }}
12
15
PUBLISH_DIR : doc/_build/html/
13
16
14
17
defaults :
@@ -130,26 +133,22 @@ jobs:
130
133
run : cp -r dpnp/backend/doc/html ${{ env.PUBLISH_DIR }}/backend_doc
131
134
132
135
# https://github.com/marketplace/actions/github-pages-action
133
- # The step is only used to build docs while pushing PR to "master"
136
+ # The step is only used to build docs while pushing a PR to "master"
134
137
- 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
138
+ if : env.GH_EVENT_PUSH_UPSTREAM
138
139
139
140
with :
140
141
github_token : ${{ secrets.GITHUB_TOKEN }}
141
142
publish_dir : ${{ env.PUBLISH_DIR }}
142
143
keep_files : true
143
144
commit_message : ${{ github.event.head_commit.message }}
144
145
publish_branch : gh-pages
145
- user_name : ${{ env.GITHUB_BOT_NAME }}
146
- user_email : ${{ env.GITHUB_BOT_EMAIL }}
146
+ user_name : ${{ env.GH_BOT_NAME }}
147
+ user_email : ${{ env.GH_BOT_EMAIL }}
147
148
148
149
# The step is only used to build docs while pushing to PR branch
149
150
- 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
151
+ if : env.GH_EVENT_PR_UPSTREAM && github.event.action != 'closed'
153
152
154
153
with :
155
154
github_token : ${{ secrets.GITHUB_TOKEN }}
@@ -159,8 +158,8 @@ jobs:
159
158
keep_files : true
160
159
commit_message : ${{ github.event.pull_request.title }}
161
160
publish_branch : gh-pages
162
- user_name : ${{ env.GITHUB_BOT_NAME }}
163
- user_email : ${{ env.GITHUB_BOT_EMAIL }}
161
+ user_name : ${{ env.GH_BOT_NAME }}
162
+ user_email : ${{ env.GH_BOT_EMAIL }}
164
163
165
164
# The step is only used to build docs while pushing to PR branch
166
165
- name : Comment with URL to published pull-request docs
@@ -177,9 +176,7 @@ jobs:
177
176
178
177
# The job is only used to build docs when PR is closed (action from PR branch)
179
178
clean :
180
- if : |
181
- github.event_name == 'pull_request' && github.event.action == 'closed' &&
182
- github.event.pull_request && !github.event.pull_request.head.repo.fork
179
+ if : env.GH_EVENT_PR_UPSTREAM && github.event.action == 'closed'
183
180
184
181
needs : build-and-deploy
185
182
@@ -199,8 +196,8 @@ jobs:
199
196
git checkout --track tokened_docs/gh-pages
200
197
echo `pwd`
201
198
[ -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 }}
199
+ git config --global user.name ${{ env.GH_BOT_NAME }}
200
+ git config --global user.email ${{ env.GH_BOT_EMAIL }}
204
201
git commit -m "Removing docs for closed pull request ${PR_NUM}"
205
202
git push tokened_docs gh-pages
206
203
0 commit comments