Conversation
How to use the Graphite Merge QueueAdd the label merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
052cae6 to
cfa792c
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR changes the method of configuring pnpm's supported CPU architectures from using pnpm config set command to appending YAML configuration directly to the pnpm-workspace.yaml file.
- Replaces
pnpm config setcommand with direct YAML file modification - Uses echo to append CPU architecture configuration to workspace file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| shell: bash | ||
| run: pnpm config set supportedArchitectures.cpu "${CPU_ARCH}" | ||
| run: echo "\nsupportedArchitectures:\n cpu:\n - ${CPU_ARCH}" >> pnpm-workspace.yaml | ||
| env: |
There was a problem hiding this comment.
The YAML formatting uses literal \n characters instead of actual newlines. This will result in malformed YAML with visible \n text instead of proper line breaks. Use a proper multi-line YAML block or printf instead of echo to ensure correct formatting.
| shell: bash | ||
| run: pnpm config set supportedArchitectures.cpu "${CPU_ARCH}" | ||
| run: echo "\nsupportedArchitectures:\n cpu:\n - ${CPU_ARCH}" >> pnpm-workspace.yaml | ||
| env: |
There was a problem hiding this comment.
Appending YAML configuration to an existing file without checking if the configuration already exists could result in duplicate entries or conflicts. Consider using a YAML manipulation tool like yq or checking for existing configuration before appending.
| env: | |
| # Install yq if not present | |
| if ! command -v yq &> /dev/null; then | |
| YQ_BIN="yq_linux_amd64" | |
| wget -qO $YQ_BIN https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| chmod +x $YQ_BIN | |
| YQ="./$YQ_BIN" | |
| else | |
| YQ="yq" | |
| fi | |
| # Set supportedArchitectures.cpu in pnpm-workspace.yaml | |
| $YQ eval '.supportedArchitectures.cpu = [env(CPU_ARCH)]' -i pnpm-workspace.yaml |
|
@JounQin doesn't work on windows https://github.com/oxc-project/oxc-resolver/actions/runs/17228005567/job/48876347915 |
| - if: ${{ inputs.cpu }} | ||
| shell: bash | ||
| run: pnpm config set supportedArchitectures.cpu "${CPU_ARCH}" | ||
| run: echo "\nsupportedArchitectures:\n cpu:\n - ${CPU_ARCH}" >> pnpm-workspace.yaml |
There was a problem hiding this comment.
Windows' bash doesn't intepret \n the same as Linux causes you problem, right?
I would use multiple echos in this case:
run: |
echo >> pnpm-workspace.yaml
echo 'supportedArchitectures:' >> pnpm-workspace.yaml
echo " cpu: [ $CPU_ARCH ]" >> pnpm-workspace.yamlAlternatively, there's echo -n but I don't know how well it would work and I prefer the multiple echo anyway.
close #672 related #673 (comment)
fix #668
close #672