Merge pull request #45 from ucsb-cs156-s24/Sreeganesh-SchoolsCRUD-Bac… #182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/checkout@v3.5.2 | |
- 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/checkout@v3.5.2 | |
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 |