From 94501dff310cb2a6cd8c83f90963bf51840867d7 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 1 Dec 2024 11:19:37 +0900 Subject: [PATCH 1/3] configure pkg.pr.new --- .github/workflows/pkg.pr.new.yml | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/pkg.pr.new.yml diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml new file mode 100644 index 00000000..c023c880 --- /dev/null +++ b/.github/workflows/pkg.pr.new.yml @@ -0,0 +1,35 @@ +name: Publish to pkg.pr.new +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + - uses: actions/setup-node@v4 + - name: Install Packages + run: pnpm install + - name: Build + run: pnpm run build + + - run: pnpx pkg-pr-new publish --comment=off --json output.json --compact --no-template + - name: Add metadata to output + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); + output.number = context.issue.number; + output.event_name = context.eventName; + output.ref = context.ref; + fs.writeFileSync('output.json', JSON.stringify(output), 'utf8'); + - name: Upload output + uses: actions/upload-artifact@v4 + with: + name: output + path: ./output.json + + - run: ls -R . From 271a1bd0dc3beb88f4d3b19a85d476cd3ee1a4b6 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 1 Dec 2024 11:59:06 +0900 Subject: [PATCH 2/3] add comment --- .github/workflows/pkg.pr.new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index c023c880..cbe92b50 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -14,7 +14,7 @@ jobs: - name: Build run: pnpm run build - - run: pnpx pkg-pr-new publish --comment=off --json output.json --compact --no-template + - run: pnpx pkg-pr-new publish --json output.json --compact --no-template - name: Add metadata to output uses: actions/github-script@v6 with: From 8be872258ee05e518cbadd5dbb02a0f993cc0dfd Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 1 Dec 2024 12:12:00 +0900 Subject: [PATCH 3/3] simplify --- .github/workflows/pkg.pr.new.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index cbe92b50..9a56335e 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -13,23 +13,4 @@ jobs: run: pnpm install - name: Build run: pnpm run build - - - run: pnpx pkg-pr-new publish --json output.json --compact --no-template - - name: Add metadata to output - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const fs = require('fs'); - const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); - output.number = context.issue.number; - output.event_name = context.eventName; - output.ref = context.ref; - fs.writeFileSync('output.json', JSON.stringify(output), 'utf8'); - - name: Upload output - uses: actions/upload-artifact@v4 - with: - name: output - path: ./output.json - - - run: ls -R . + - run: pnpx pkg-pr-new publish --compact