Skip to content

Commit

Permalink
refactor: 💡 CI/CD Changeset Status check for CLI (#20)
Browse files Browse the repository at this point in the history
## Why?

The CI/CD Changeset Status check, now gets the diff-tree recursively and
match checks for a regex pattern of `.changeset/<filename>.md`. For some
reason the current version is not working in CI/CD.

⚠️ Related to FleekHQ/fleek#3216

-
[PLAT-1396](https://linear.app/fleekxyz/issue/PLAT-1396/cicd-changeset-status-check-is-failing)

## How?

- Extend pattern match to match markdown extension
- Show diff status output

## Tickets?

-
[PLAT-1396](https://linear.app/fleekxyz/issue/PLAT-1396/cicd-changeset-status-check-is-failing)

## Contribution checklist?

- [x] The commit messages are detailed
- [x] The `build` command runs locally
- [ ] Assets or static content are linked and stored in the project
- [ ] You have manually tested
- [ ] You have provided tests

## Security checklist?

- [ ] Sensitive data has been identified and is being protected properly
- [ ] Injection has been prevented (parameterized queries, no eval or
system calls)

## Preview?

Optionally, provide the preview url here
  • Loading branch information
heldrida authored Sep 2, 2024
1 parent 8cb4e90 commit d3d4a53
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/changeset-version-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,23 @@ jobs:
# Default skip state
skip="false"
# Changeset artifacts
changesetArtifactsPath=".changeset"
changesetArtifactsRegex="\.changeset/.*\.md$"
# Commit hash that triggered workflow
commitHash="${{ github.sha }}"
pendingChangesetList=$(find .changeset -type f -name "*.md" ! -name "README.md")
if [[ -n "$pendingChangesetList" ]]; then
echo "⚠️ There are pending changeset files:"
echo "$pendingChangesetList"
fi
# If no changes found, skip
if ! git diff-tree --no-commit-id --name-only "$commitHash" | grep -q "$changesetArtifactsPath"; then
if echo "$pendingChangesetList" | 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 d3d4a53

Please sign in to comment.