Skip to content

Commit

Permalink
chore: 🤖 changeset status recursive and regex pattern match
Browse files Browse the repository at this point in the history
  • Loading branch information
heldrida committed Sep 2, 2024
1 parent 8cb4e90 commit 4d91f5f
Showing 1 changed file with 13 additions and 4 deletions.
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

0 comments on commit 4d91f5f

Please sign in to comment.