build(deps-dev): bump the react group across 1 directory with 7 updates #826
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
name: PR Checks | |
on: | |
pull_request: | |
branches: | |
- '*' | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install Dependencies 📦 | |
run: yarn install | |
- name: Lint 🧼 | |
run: yarn lint | |
- name: Test 🧪 | |
run: yarn test | |
- name: SonarCloud 🔬 | |
# Don't run SonarCloud on PRs from forks | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
uses: sonarsource/sonarcloud-github-action@v2.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Build 🛠️ | |
run: yarn build | |
- name: Build Storybook | |
# Don't run Storybook build on PRs from forks | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
run: yarn build:storybook | |
- name: Create and Upload Storybook to PR directory | |
# Don't run Storybook upload on PRs from forks | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
run: | | |
PR_NUMBER="PR-${{ github.event.number }}" | |
git config user.name "evargast" | |
git config user.email "52969178+evargast@users.noreply.github.com" | |
# Fetch the existing gh-pages branch | |
git fetch origin gh-pages | |
# Checkout the existing gh-pages branch | |
git checkout gh-pages | |
# Remove the PR directory if it exists | |
rm -rf "${PR_NUMBER}" | |
# Create the PR directory | |
mkdir "${PR_NUMBER}" | |
# Copy the contents of dist-storybook to the directory | |
cp -r dist-storybook/* "${PR_NUMBER}/" | |
rm -rf node_modules # Explicitly remove the node_modules directory | |
rm -rf dist-storybook # Explicitly remove the dist-storybook directory | |
# Add, commit, and push changes | |
git add "${PR_NUMBER}/." | |
git commit -m "Update Storybook for ${PR_NUMBER}" | |
git push -f origin gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add comment to the PR with Storybook URL | |
# Don't add comment on PRs from forks | |
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
run: | | |
PR_NUMBER="${{ github.event.number }}" | |
COMMENT_BODY="🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-${PR_NUMBER}" | |
curl -sSL \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-X POST \ | |
-d '{"body":"'"${COMMENT_BODY}"'"}' \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |