-
Notifications
You must be signed in to change notification settings - Fork 677
ci(galaxy): push previews to the registry #7053
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
base: main
Are you sure you want to change the base?
Conversation
|
Scalar Components Snapshot Test ResultsDetails
|
Scalar CDN Snapshot Diff ResultsDetails
Important These tests detect visual differences between the current PR and the latest CDN build which means they may be affected by other changes in They can help determine if the changes in the PR are causing any unexpected visual regressions but may be less helpful in isolating the exact cause. For more details see the readme. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unconditional Preview Deletion Causes API Overhead
The delete-preview job attempts to delete a preview version without first checking if galaxy files were modified in the PR. This can lead to unnecessary API calls and potential workflow failures when no preview was ever published.
.github/workflows/scalar-registry-preview.yml#L56-L81
scalar/.github/workflows/scalar-registry-preview.yml
Lines 56 to 81 in 9fa7895
| delete-preview: | |
| if: github.event.action == 'closed' | |
| runs-on: blacksmith-4vcpu-ubuntu-2204 | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| node-version: [22] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Extract version and generate preview version | |
| working-directory: packages/galaxy | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| BRANCH_NAME=$(echo "${{ github.head_ref }}" | sed 's/[^a-zA-Z0-9-]/-/g') | |
| PREVIEW_VERSION="${VERSION}-${BRANCH_NAME}" | |
| echo "PREVIEW_VERSION=$PREVIEW_VERSION" >> $GITHUB_ENV | |
| - name: Login to Scalar Registry | |
| run: npx @scalar/cli@latest auth login --token ${{ secrets.SCALAR_API_KEY }} | |
| - name: Delete preview version from Scalar Registry | |
| run: npx @scalar/cli@latest registry delete --namespace scalar --slug galaxy --version ${{ env.PREVIEW_VERSION }} |
| if: github.event.action == 'closed' | ||
| runs-on: blacksmith-4vcpu-ubuntu-2204 | ||
| timeout-minutes: 10 | ||
| strategy: | ||
| matrix: | ||
| node-version: [22] | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | ||
|
|
||
| - name: Extract version and generate preview version | ||
| working-directory: packages/galaxy | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| BRANCH_NAME=$(echo "${{ github.head_ref }}" | sed 's/[^a-zA-Z0-9-]/-/g') | ||
| PREVIEW_VERSION="${VERSION}-${BRANCH_NAME}" | ||
| echo "PREVIEW_VERSION=$PREVIEW_VERSION" >> $GITHUB_ENV | ||
|
|
||
| - name: Login to Scalar Registry | ||
| run: npx @scalar/cli@latest auth login --token ${{ secrets.SCALAR_API_KEY }} | ||
|
|
||
| - name: Delete preview version from Scalar Registry | ||
| run: npx @scalar/cli@latest registry delete --namespace scalar --slug galaxy --version ${{ env.PREVIEW_VERSION }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 days ago
The fix is to add a permissions block to the delete-preview job within the .github/workflows/scalar-registry-preview.yml file. According to the CodeQL recommendation and the intended actions in delete-preview (no writing to the repository, only Scalar Registry management via CLI), the safest minimal permissions block is:
permissions:
contents: readThis should be inserted at the same level as (and directly after) timeout-minutes: 10 for the delete-preview job, mirroring how permissions is set for publish-update-preview. No other changes are needed.
-
Copy modified lines R74-R75
| @@ -71,6 +71,8 @@ | ||
| if: github.event.action == 'closed' | ||
| runs-on: blacksmith-4vcpu-ubuntu-2204 | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| matrix: | ||
| node-version: [22] |
86565dc to
93465ac
Compare
This commit introduces a new GitHub Actions workflow for managing preview versions of the @scalar/galaxy package. The workflow triggers on pull request events, allowing for the automatic building, versioning, and publishing of preview versions to the Scalar Registry. Additionally, it includes a step to delete the preview version when the pull request is closed.
This commit modifies the Scalar Registry Preview workflow to ensure that the Scalar CLI commands use the latest version by appending `@latest` to the CLI commands for login and publish operations. This change enhances compatibility and ensures that the most recent features and fixes are utilized during the workflow execution.
8b75d5c to
8ccb853
Compare
|
Scalar Registry Preview https://registry.scalar.com/@scalar/apis/galaxy/0.5.9-ci-galaxy-preview |
Scalar References End to End Test ResultsDetails
Important These tests include snapshots that may need to be updated if there are intentional changes to the UI components. To update the snapshots run |
Problem
Currently, we push the Scalar Galaxy example to the Registry on release, that’s fine. I’d like to see if we can have PR previews for the OpenAPI document, too.
Solution
This PR adds a new workflow, that looks for changes to @scalar/galaxy.
When there’s a change, it pushes the updated OpenAPI document to the Registry.
To avoid conflicts, it’s adding the branch to the version number.
Tasks
--no-currentdoesn't seem to work), waiting for the next @scalar/cli releaseChecklist
I've gone through the following:
pnpm changeset).Note
Adds a CI workflow to publish/delete PR preview versions of Galaxy to Scalar Registry and updates the OpenAPI title to indicate PREVIEW.
.github/workflows/scalar-registry-preview.ymlto publish PR previews of@scalar/galaxyto Scalar Registry onopened/synchronize, including version suffix with branch; delete preview onclosed.@scalar/galaxyonly whenpackages/galaxy/**changes, logs in viaSCALAR_API_KEY, and publishespackages/galaxy/dist/latest.yamlwith generated preview version.packages/galaxy/src/documents/3.1.yamlinfo.titletoScalar Galaxy (PREVIEW).Written by Cursor Bugbot for commit 9fa7895. This will update automatically on new commits. Configure here.