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

refactor: 💡 CI/CD Changeset Status check for CLI #20

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Changes from 1 commit
Commits
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
17 changes: 13 additions & 4 deletions .github/workflows/changeset-version-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,25 @@ jobs:
# Default skip state
skip="false"
# Changeset artifacts
changesetArtifactsPath=".changeset"
changesetArtifactsRegex="\.changeset/.*\.md$"
# Commit hash that triggered workflow
commitHash="${{ github.sha }}"
diffTree=$(git diff-tree --no-commit-id --name-only -r "$commitHash")
if [[ -n "$diffTree" ]]; then
echo "⚠️ The diff command found:"
echo "$diffTree"
else
echo "⚠️ The diff result is empty!"
fi
# If no changes found, skip
if ! git diff-tree --no-commit-id --name-only "$commitHash" | grep -q "$changesetArtifactsPath"; then
if echo "$diffTree" | grep -qE "$changesetArtifactsRegex"; then
echo "✅ Changeset found!"
else
echo "⚠️ Warning: The .changeset directory doesn't have new changesets, should skip!"
skip="true"
else
echo "✅ Changset found!"
fi
echo "skip=$skip" >> "$GITHUB_OUTPUT"
Expand Down