Skip to content

Added tooltip UX to School variables(abbrev, desc, regex) #75

Added tooltip UX to School variables(abbrev, desc, regex)

Added tooltip UX to School variables(abbrev, desc, regex) #75

# Creates/Resets the gh-pages branch to the intended start state
name: "54-storybook-pr: Update storybook for a pr to main"
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- frontend/**
- .github/workflows/54-storybook-pr.yml
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
pages: write
id-token: write
jobs:
get-pr-num:
name: Get PR Number
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.get-pr-num.outputs.pr_number }}
branch_name: ${{ steps.get-branch-name.outputs.branch_name }}
steps:
- name: Checkout repo
uses: actions/checkout@v3.5.2
with:
fetch-depth: 1
token: ${{ github.token }}
- name: Get PR number
id: get-pr-num
run: |
echo "GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH}"
pr_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo "pr_number=${pr_number}"
echo "pr_number=${pr_number}" >> "$GITHUB_OUTPUT"
- name: Figure out Branch name
id: get-branch-name
run: |
GITHUB_HEAD_REF="${GITHUB_HEAD_REF}"
echo GITHUB_HEAD_REF=${GITHUB_HEAD_REF}
GITHUB_REF_CLEANED=${GITHUB_REF/refs\/heads\//}
echo GITHUB_REF_CLEANED=${GITHUB_REF_CLEANED}
GITHUB_REF_CLEANED=${GITHUB_REF_CLEANED//\//-}
echo GITHUB_REF_CLEANED=${GITHUB_REF_CLEANED}
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_CLEANED}}"
echo "branch_name=${BRANCH}"
echo "branch_name=${BRANCH}" >> "$GITHUB_OUTPUT"
build-storybook-for-this-pr:
name: Build Storybook for PR
runs-on: ubuntu-latest
needs: [get-pr-num]
steps:
- name: Debugging output
run: |
echo "pr_number=${{needs.get-pr-num.outputs.pr_number}}"
echo "branch_name=${{needs.get-pr-num.outputs.branch_name}}"
- name: Checkout repo
uses: actions/checkout@v3.5.2
with:
ref: ${{ needs.get-pr-num.outputs.branch_name }}
fetch-depth: 1
token: ${{ github.token }}
- name: Setup Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Build Storybook for PR branch
working-directory: frontend
run: | # Install npm packages and build the Storybook files
npm install
npx build-storybook --docs -o storybook_static_${{ needs.get-pr-num.outputs.pr_number }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: frontend/storybook_static_${{ needs.get-pr-num.outputs.pr_number }} # The folder that the build-storybook script generates files.
clean: true # Automatically remove deleted files from the deploy branch
target-folder: prs/${{ needs.get-pr-num.outputs.pr_number }}/storybook # The folder that we serve our Storybook files from