Skip to content

Commit

Permalink
Update Deploy Preview.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rLukoyanov authored Aug 7, 2024
1 parent b0a498b commit 6b23b8f
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/Deploy Preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,11 @@ jobs:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
npx vercel --prod --token $VERCEL_TOKEN --org-id $VERCEL_ORG_ID --project-id $VERCEL_PROJECT_ID --confirm
DEPLOY_URL=$(npx vercel --prod --token $VERCEL_TOKEN --org-id $VERCEL_ORG_ID --project-id $VERCEL_PROJECT_ID --confirm | tail -n 1)
echo "Vercel Deployment URL: $DEPLOY_URL"
echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_ENV
id: vercel-deploy

- name: Get Vercel Deployment URL
run: echo "Vercel Deployment URL: $(npx vercel --token $VERCEL_TOKEN ls --scope $VERCEL_ORG_ID | grep -o 'https://[^ ]*')" > vercel_url.txt
id: get-url
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

- name: Save Deployment URL as GitHub output
id: save-url
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const url = fs.readFileSync('vercel_url.txt', 'utf8').trim();
core.setOutput('vercel-url', url);
- name: Comment on Pull Request
uses: actions/github-script@v6
with:
Expand All @@ -56,7 +43,7 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Deployed to Vercel: ${url}`
body: `Deployed to Vercel: ${process.env.DEPLOY_URL}`
})
env:
url: ${{ steps.save-url.outputs.vercel-url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6b23b8f

Please sign in to comment.