-
Notifications
You must be signed in to change notification settings - Fork 283
49 lines (46 loc) · 1.46 KB
/
clear.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: clear
on:
workflow_dispatch:
# issue_comment:
# types: [created]
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }}
cancel-in-progress: true
jobs:
clear:
if: |
github.event_name == 'workflow_dispatch' ||
(
github.event.issue.pull_request &&
contains(github.event.comment.body, '/clear-build')
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.issue.pull_request && format('refs/pull/{0}/merge', github.event.issue.number) || '' }}
- name: Prepare Yarn
uses: ./.github/actions/prepare/
- name: Clear Docusaurus build cache
run: yarn clear
- name: Prepare build
run: yarn prepare
shell: bash
- name: Generate API
run: yarn generate:api
shell: bash
- name: Build
run: yarn build
# Create a comment on the pull request that the clear build completed
- name: Comment on pull request
if: github.event_name != 'workflow_dispatch'
uses: actions/github-script@v6.4.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Clear build has completed and caches have been renewed.`
})