-
Notifications
You must be signed in to change notification settings - Fork 860
chore(workflows): run changelog check in CI for every public package
#9041
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
Changes from all commits
fd7da3c
a3ab9c7
c3185ee
78e8bbf
c2f1924
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: Detect package changes | ||
| description: 'Detects which public packages have changed based on git diff' | ||
| outputs: | ||
| changed-packages: | ||
| description: 'A JSON array of changed public package names' | ||
| value: ${{ steps.changes.outputs.changed-packages }} | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Detect package changes | ||
| id: changes | ||
| shell: bash | ||
| run: ${{ github.action_path }}/entrypoint.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Exit on error | ||
| set -e | ||
|
|
||
| # Get the list of changed files | ||
| changed_files=$(git diff --name-only origin/main...HEAD) | ||
|
|
||
| # Find all public packages and check for changes | ||
| public_packages=() | ||
| for dir in packages/*/; do | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Not a change request] Yarn workspaces can technically have packages in different places than just the |
||
| if [ -f "${dir}package.json" ] && ! grep -q '"private": true' "${dir}package.json"; then | ||
| package_name=$(basename "$dir") | ||
| if echo "$changed_files" | grep -q "^packages/$package_name/"; then | ||
| public_packages+=("\"$package_name\"") | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| # Output a JSON array of changed package names | ||
| if [ ${#public_packages[@]} -gt 0 ]; then | ||
| changed_list=$(IFS=,; echo "[${public_packages[*]}]") | ||
| echo "changed-packages=$changed_list" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "changed-packages=[]" >> $GITHUB_OUTPUT | ||
| fi | ||
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.
[Not a change request]
This could be simplified by relying on yarn's
--sinceargument that lists packages changed since a specific ref (docs).