Add release post for 2.18.0 #387
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preview | |
on: | |
pull_request_target: | |
jobs: | |
preview: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { owner, repo } = context.repo; | |
const { number } = context.issue; | |
const pr = await github.rest.pulls.get({ | |
owner, | |
repo, | |
pull_number: number, | |
}); | |
const { merge_commit_sha } = pr.data; | |
const head_sha = pr.data.head.sha; | |
const link = `https://stackblitz.com/github/mlflow/mlflow-website/tree/${merge_commit_sha}/website`; | |
const marker = "<!-- PREVIEW -->"; | |
const body = ` | |
${marker} | |
## Preview for ${head_sha} | |
- For faster build, the doc pages are not included in the preview. | |
- Redirects are disabled in the preview. | |
<a href="${link}" target="_blank"> | |
<img | |
alt="Open in StackBlitz" | |
src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" | |
/> | |
</a> | |
`; | |
const comments = await github.paginate(github.rest.issues.listComments, { | |
owner, | |
repo, | |
issue_number: number, | |
}); | |
const comment = comments.find(({ body }) => body.includes(marker)); | |
if (comment) { | |
await github.rest.issues.updateComment({ | |
comment_id: comment.id, | |
owner, | |
repo, | |
body, | |
}); | |
} else { | |
await github.rest.issues.createComment({ | |
issue_number: number, | |
owner, | |
repo, | |
body, | |
}); | |
} |