From 59f81b0351782d9dfdfd0fd249f6f5d29aa138e1 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Tue, 29 Oct 2024 12:01:56 +0300 Subject: [PATCH] ci: add notice on repo mismatch --- .github/workflows/npm-publish-from-pr.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish-from-pr.yml b/.github/workflows/npm-publish-from-pr.yml index 6719481..0c7f074 100644 --- a/.github/workflows/npm-publish-from-pr.yml +++ b/.github/workflows/npm-publish-from-pr.yml @@ -59,9 +59,12 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Notice + if: github.event.inputs.repo != github.repository + run: node -e "const fs = require('fs'); fs.writeFileSync('./README.md', process.env.NOTICE + fs.readFileSync('./README.md'))" + env: + NOTICE: "> ⚠ **This snapshot was built from the external source** \n> repo: ${{ github.event.inputs.repo }} \n> commit: ${{ github.event.inputs.commit }}\n" + - run: | - node -e "const fs = require('fs'); fs.writeFileSync('./README.md', process.env.NOTICE + fs.readFileSync('./README.md'))" npm version $(node --eval="process.stdout.write(require('./package.json').version)")-pr.${{ github.run_id }} --no-git-tag-version npm publish --provenance --access=public --no-git-tag-version --tag pr - env: - NOTICE: "> ⚠ **This snapshot was built from the external source** \n> repo: ${{ github.event.inputs.repo }} \n> commit: ${{ github.event.inputs.commit }}\n"