-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (75 loc) · 2.57 KB
/
01-gh-pages-pr-table.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This workflow updates the open PRs in
# _config.yml each time a pull request is made
# or there is a push to main. It does not handle
# the rebuild of the storybook or javadoc; that's handled
# separately based on which files were modified.
name: "01-gh-pages-pr-table: Rebuild table of PRs"
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
pages: write
id-token: write
pull-requests: read
jobs:
get-pull-requests:
name: Get Pull Requests
runs-on: ubuntu-latest
outputs:
pull_requests: ${{ steps.get-prs.outputs.pull_requests }}
steps:
- name: Checkout local code to establish repo
uses: actions/[email protected]
- name: Get Pull Requests from Github api
id: get-prs
run: |
gh pr list -s open --json url,author,number,title,headRefName
gh pr list -s open --json url,author,number,title,headRefName > prs.json
cat prs.json
pull_requests=`cat prs.json`
echo "pull_requests=${pull_requests}"
echo "pull_requests=${pull_requests}" >> "$GITHUB_OUTPUT"
build-basic-site:
name: Build Basic Site
runs-on: ubuntu-latest
needs: [get-pull-requests]
steps:
- name: Checkout local code to establish repo
uses: actions/[email protected]
with:
fetch-depth: 1
- name: Append name of site to _config.yml
run: |
CONFIG_YML=frontend/docs-index/_config.yml
OWNER_PLUS_REPOSITORY=${{github.repository}}
OWNER=${{ github.repository_owner }}
REPOSITORY=${OWNER_PLUS_REPOSITORY/$OWNER\//}
echo "repo: ${OWNER_PLUS_REPOSITORY}" >> ${CONFIG_YML}
echo "owner: ${OWNER}" >> ${CONFIG_YML}
echo "repo_name: ${REPOSITORY}" >> ${CONFIG_YML}
cat ${CONFIG_YML}
- name: Store PRs as JSON in _config.yml
run: |
pull_requests=${{toJSON(needs.get-pull-requests.outputs.pull_requests)}}
CONFIG_YML=frontend/docs-index/_config.yml
echo "pull_requests: ${pull_requests}, CONFIG_YML: ${CONFIG_YML}"
echo "pull_requests: ${pull_requests}" >> ${CONFIG_YML}
cat ${CONFIG_YML}
- name: Compose web site
run: |
mkdir -p site
cp -r frontend/docs-index/* site
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site # The folder the action should deploy.
branch: gh-pages
clean: false # Automatically remove deleted files from the deploy branch