File tree 1 file changed +30
-2
lines changed
1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -164,9 +164,37 @@ jobs:
164
164
action: auto
165
165
` ` `
166
166
167
- # ## Reimplementing `auto`
167
+ # ## Only remove previews for unmerged PRs
168
168
169
- If you don't trust my implementation of `auto`, you can do it yourself
169
+ Information from the context and conditionals can be used to make more
170
+ complex decisions about what to do with previews; for example, removing
171
+ only those associated with _unmerged_ PRs when they are closed :
172
+
173
+ ` ` ` yml
174
+ # .github/workflows/preview.yml
175
+ name: Deploy PR previews; removed closed unmerged PR previews
176
+ on:
177
+ pull_request:
178
+ types:
179
+ - synchronize
180
+ - closed
181
+ jobs:
182
+ deploy-preview:
183
+ runs-on: ubuntu-20.04
184
+ steps:
185
+ - uses: actions/checkout@v2
186
+ - run: npm i && npm run build
187
+ - uses: rossjrw/pr-preview-action@v1
188
+ if: github.event.action == "synchronize"
189
+ with:
190
+ source-dir: ./build/
191
+ action: deploy
192
+ - uses: rossjrw/pr-preview-action@v1
193
+ if: github.event.action == "closed" && !github.event.pull_request.merged
194
+ with:
195
+ source-dir: ./build/
196
+ action: remove
197
+ ` ` `
170
198
171
199
# ## Permanent previews
172
200
You can’t perform that action at this time.
0 commit comments