diff --git a/.github/workflows/pr-changeset.yml b/.github/workflows/pr-changeset.yml index c2a75dd..41d9496 100644 --- a/.github/workflows/pr-changeset.yml +++ b/.github/workflows/pr-changeset.yml @@ -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 "action@github.com" # 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