-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ on: | |
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
jobs: | ||
remind: | ||
name: Changeset Reminder | ||
changeset: | ||
name: Run Changeset | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
|
@@ -15,36 +15,25 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check for Changeset | ||
id: changeset-check | ||
run: | | ||
echo "Checking for changeset files..." | ||
CHANGESET_FILES=$(git diff --name-only origin/${{ github.base_ref }}..origin/${{ github.head_ref }} | grep '^\.changeset/' || true) | ||
echo "Changeset files found: $CHANGESET_FILES" | ||
if [ -n "$CHANGESET_FILES" ]; then | ||
echo "changeset=true" >> $GITHUB_OUTPUT | ||
echo "Changeset found" | ||
else | ||
echo "changeset=false" >> $GITHUB_OUTPUT | ||
echo "No changeset found" | ||
fi | ||
- name: Add Changeset Reminder Comment | ||
if: steps.changeset-check.outputs.changeset == 'false' | ||
uses: actions/github-script@v6 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
console.log('Adding changeset reminder comment...'); | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.name, | ||
body: 'Thank you for your contribution! It seems that this PR does not include a changeset. If this PR includes changes that should be reflected in the changelog, please add a changeset by running `npm run changeset` and committing the generated file. If no changeset is needed, you can ignore this message.' | ||
}); | ||
console.log('Changeset reminder comment added successfully'); | ||
node-version: "16" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run Changeset | ||
run: npm run changeset | ||
|
||
# Optional: Examine the changes generated by Changeset | ||
- name: Review Changeset Files | ||
run: cat .changeset/* || echo "No changeset files created" | ||
|
||
- name: Log Workflow Summary | ||
- name: Commit and push changes | ||
run: | | ||
echo "Workflow Summary:" | ||
echo "- PR | ||
git config --local user.email "[email protected]" # Use operational account email | ||
git config --local user.name "GitHub Action" | ||
git add .changeset | ||
git commit -m "Add changeset" || echo "No changes to commit" | ||
git push |