diff --git a/.github/workflows/build-dist.yml b/.github/workflows/build-dist.yml new file mode 100644 index 0000000000..3882185381 --- /dev/null +++ b/.github/workflows/build-dist.yml @@ -0,0 +1,47 @@ +name: Build and PR dist changes + +on: + push: + branches: [main] + +jobs: + build-and-pr-dist: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + with: + node-version: "lts/*" + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build + + - name: Check for dist changes + id: git-diff + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add dist + if git diff --cached --quiet; then + echo "changed=false" >> $GITHUB_OUTPUT + else + echo "changed=true" >> $GITHUB_OUTPUT + fi + + - name: Create Pull Request for dist changes + if: steps.git-diff.outputs.changed == 'true' + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "chore(dist): update dist folder after build" + title: "chore(dist): update dist folder after build" + body: "This PR updates the dist folder with the latest build output." + branch: update-dist-after-build + add-paths: dist