From 34ebc53452291eee954f0ca779c2dcccb89cf39b Mon Sep 17 00:00:00 2001 From: Eric Hibbs Date: Wed, 6 Nov 2024 14:33:13 -0800 Subject: [PATCH] fixing pr commenting step --- .github/workflows/pr-preview.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 4c826de..65c0882 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -62,9 +62,12 @@ jobs: - name: Comment on PR uses: actions/github-script@v7 + env: + VERSION: ${{ env.VERSION }} with: script: | const version = process.env.VERSION; + const prNumber = context.payload.pull_request.number; const comment = ` 🚀 Preview package published! @@ -73,15 +76,16 @@ jobs: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==${version} \`\`\` - Docker image: \`socketdev/cli:pr-${context.issue.number}\` + Docker image: \`socketdev/cli:pr-${prNumber}\` `; github.rest.issues.createComment({ - issue_number: context.issue.number, + issue_number: prNumber, owner: context.repo.owner, repo: context.repo.name, body: comment - }) + }); + - name: Login to Docker Hub uses: docker/login-action@v3 @@ -91,6 +95,8 @@ jobs: - name: Build & Push Docker Preview uses: docker/build-push-action@v5 + env: + VERSION: ${{ env.VERSION }} with: push: true tags: socketdev/cli:pr-${{ github.event.pull_request.number }}