diff --git a/.github/workflows/changeset-handler.yml b/.github/workflows/changeset-handler.yml index 1984295..7d673ae 100644 --- a/.github/workflows/changeset-handler.yml +++ b/.github/workflows/changeset-handler.yml @@ -36,55 +36,74 @@ jobs: node-version: 20 cache: 'pnpm' - - name: Get pnpm store directory + - name: Changeset status + id: changeset-status shell: bash run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + if ! pnpm changeset:status &>/dev/null; then + echo "⚠️ Warning: No changesets found, should skip!" + echo "skip=true" >> "$GITHUB_OUTPUT" + fi - - name: Install dependencies + - name: TIAS run: | - pnpm install \ - --strict-peer-dependencies + echo "[debug] ${{ steps.changeset-status.outputs.skip }}" + - - name: Set version - run: | - pnpm changeset:version - git status --short + # - name: Get pnpm store directory + # if: ${{ steps.changeset-status.skip != 'true' }} + # shell: bash + # run: | + # echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - name: Commit changes - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" + # - uses: actions/cache@v4 + # if: ${{ steps.changeset-status.skip != 'true' }} + # name: Setup pnpm cache + # with: + # path: ${{ env.STORE_PATH }} + # key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + # restore-keys: | + # ${{ runner.os }}-pnpm-store- + + # - name: Install dependencies + # if: ${{ steps.changeset-status.skip != 'true' }} + # run: | + # pnpm install \ + # --strict-peer-dependencies + + # - name: Set version + # if: ${{ steps.changeset-status.skip != 'true' }} + # run: | + # pnpm changeset:version + # git status --short + + # - name: Commit changes + # if: ${{ steps.changeset-status.skip != 'true' }} + # run: | + # git config --global user.name "github-actions[bot]" + # git config --global user.email "github-actions[bot]@users.noreply.github.com" - if ! git add -A; then - echo "👹 Oops! Failed stage changes" - exit 1 - fi + # if ! git add -A; then + # echo "👹 Oops! Failed stage changes" + # exit 1 + # fi - echo "✅ Staged all changes!" + # echo "✅ Staged all changes!" - pkgVersion=$(node -p "require('./package.json').version") - if ! git commit \ - --allow-empty \ - --no-verify \ - -m "[skip ci] 🦖 updated package version to $pkgVersion"; then - echo "👹 Oops! Failed to commit package version." - exit 1 - fi + # pkgVersion=$(node -p "require('./package.json').version") + # if ! git commit \ + # --allow-empty \ + # --no-verify \ + # -m "[skip ci] 🦖 updated package version to $pkgVersion"; then + # echo "👹 Oops! Failed to commit package version." + # exit 1 + # fi - echo "✅ Committed package version!" + # echo "✅ Committed package version!" - if ! git push; then - echo "👹 Oops! Failed to push changes." - exit 1 - fi + # if ! git push; then + # echo "👹 Oops! Failed to push changes." + # exit 1 + # fi - echo "✅ Pushed changes to repository!" + # echo "✅ Pushed changes to repository!" diff --git a/package.json b/package.json index c9a3988..a21b573 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build:ci": "pnpm run build", "bundle": "ts-node -r dotenv/config bundle.ts", "changeset:add": "npx changeset", + "changeset:add": "npx changeset status", "changeset:version": "pnpm exec changeset version", "clean": "pnpm \"/^clean:.*/\"", "clean:dist": "rm -rf dist",