Skip to content

Commit

Permalink
Merge branch 'mwong-add-preview-link' into test-preview-link-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Sep 25, 2024
2 parents ac4c66d + e073651 commit f62868e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,25 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const deploymentUrl = `🚀 Deployment available at: [${{ steps.vercel_url.outputs.deployment_url }}](${{ steps.vercel_url.outputs.deployment_url }})`;
const links = `Here are the direct links to the updated files:\n${{ steps.links.outputs.links }}`;
const summary = `${deploymentUrl}\n\n${links}`;
// Check if a check run already exists
const checkRuns = await github.checks.listForRef({
// Access octokit.rest instead of github
const checkRuns = await octokit.rest.checks.listForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.payload.pull_request.head.sha,
});
const existingCheckRun = checkRuns.data.check_runs.find(
(run) => run.name === 'Vercel Deployment Preview'
);
if (existingCheckRun) {
// Update the existing check run
await github.checks.update({
await octokit.rest.checks.update({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: existingCheckRun.id,
Expand All @@ -158,7 +158,7 @@ jobs:
});
} else {
// Create a new check run
await github.checks.create({
await octokit.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'Vercel Deployment Preview',
Expand All @@ -171,3 +171,4 @@ jobs:
},
});
}

0 comments on commit f62868e

Please sign in to comment.