Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chromatic preview link testing #1459

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
511277d
add chromatic summary
jamigibbs Jan 16, 2025
f4e905d
output storybook urls
jamigibbs Jan 16, 2025
2d7d423
add diagnostics flag
jamigibbs Jan 16, 2025
c8104d1
log the diagnostics file
jamigibbs Jan 16, 2025
0162a4e
get branch name from diagnostics file
jamigibbs Jan 21, 2025
9308961
update branch name key
jamigibbs Jan 21, 2025
c4c2105
update file name
jamigibbs Jan 21, 2025
c989327
try artifact
jamigibbs Jan 21, 2025
602e7e0
update artifact path
jamigibbs Feb 3, 2025
02025ca
update upload-artifact action to v4
jamigibbs Feb 3, 2025
d9b63b3
update path to read the diagnostics file
jamigibbs Feb 3, 2025
8386b65
print the diagnostics file
jamigibbs Feb 3, 2025
cb61639
test custom branch name
jamigibbs Feb 3, 2025
fc0aaf9
check storybook log file
jamigibbs Feb 3, 2025
4079670
update for log file
jamigibbs Feb 3, 2025
50b4a39
test formatted branch name for preview
jamigibbs Feb 3, 2025
9f26116
move branch formating and print chromatic summary
jamigibbs Feb 3, 2025
87b5502
use PR number for preview link
jamigibbs Feb 4, 2025
341d374
revert workflow trigger
jamigibbs Feb 4, 2025
09188c8
test visual change
jamigibbs Feb 4, 2025
adb8840
add pr number as env variable
jamigibbs Feb 5, 2025
4c29491
add checkout action
jamigibbs Feb 5, 2025
5e0585f
move pr number env var assigment
jamigibbs Feb 5, 2025
4259a5a
move PR_NUMBER env back to pr workflow
jamigibbs Feb 5, 2025
d9e500f
check chromatic url values again, revert some stuff
jamigibbs Feb 6, 2025
942bffb
more chromatic url output testing
jamigibbs Feb 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!-- This `{{head.ref}}` is a placeholder for a CI job - it will be updated automatically -->
https://{{head.ref}}--65a6e2ed2314f7b8f98609d8.chromatic.com

https://STORYBOOK_PREVIEW_BRANCH--65a6e2ed2314f7b8f98609d8.chromatic.com

---
## Configuring this pull request
- [ ] Link to any related issues in the description so they can be cross-referenced.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/chromatic-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ jobs:
- uses: luigibertaco/[email protected]
with:
token: '${{ secrets.GITHUB_TOKEN }}'

29 changes: 28 additions & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,38 @@ jobs:
- run: yarn workspace @department-of-veterans-affairs/web-components run build
- run: yarn workspace @department-of-veterans-affairs/component-library run build
- name: Publish to Chromatic
id: chromatic
uses: chromaui/action@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
# Chromatic projectToken, refer to the manage page to obtain it.
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
onlyChanged: true
workingDir: packages/storybook
skip: 'dependabot/**'
# branchName: pr-${{ env.PR_NUMBER}}

- name: Output Chromatic Results
id: chromatic_urls
run: |
echo "=== Debug Information ==="
echo "Original Storybook URL: ${{ steps.chromatic.outputs.storybookUrl }}"
echo "Original Build URL: ${{ steps.chromatic.outputs.buildUrl }}"
echo "Current branch name: ${{ github.ref_name }}"

# Extract the project URL and branch slug from Storybook URL
PROJECT_URL=$(echo "${{ steps.chromatic.outputs.storybookUrl }}" | sed -E 's/--.*\.chromatic\.com.*//')
BRANCH_SLUG=$(echo "${{ steps.chromatic.outputs.storybookUrl }}" | grep -o -- "--.*\." | sed 's/--\(.*\)\./\1/')

echo "=== Extracted Components ==="
echo "Project URL: ${PROJECT_URL}"
echo "Branch Slug: ${BRANCH_SLUG}"

# Construct the final branch URL
BRANCH_URL="${PROJECT_URL}.chromatic.com/branch/${BRANCH_SLUG}"

echo "=== Final URLs ==="
echo "Branch permalink: ${BRANCH_URL}"

# Set output for use in other steps if needed
echo "branch_url=${BRANCH_URL}" >> $GITHUB_OUTPUT
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export class VaAccordion {
(this.accordionContainer = accordionContainer)
}
>
<h1>Hello world!</h1>
{!openSingle ? (
<button
aria-expanded={`${this.expanded}`}
Expand Down
Loading