Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GHA to add a comment displaying preview information on each opened PR #2603

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/preview-info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Show preview on PRs

on:
pull_request:
types: [opened]

env:
GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }}
CURRENT_BRANCH: ${{ github.event.pull_request.head.ref }}

jobs:
preview-info:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare comment content
run: |
echo '## How to see the preview of this PR?' >> comment.txt
echo '' >> comment.txt
echo '⚠️ Private link, only accessible to Meilisearch employees.' >> comment.txt
echo '' >> comment.txt
echo "Go to this URL: https://website-git-deploy-preview-mei-16-meili.vercel.app/docs/branch:$CURRENT_BRANCH" >> comment.txt
echo '' >> comment.txt
echo "Credentials to access the page are in the company\'s password manager as \"Docs deploy preview\"." >> comment.txt
- name: Add comment to PR with preview information
run: |
gh pr comment $CURRENT_BRANCH --body-file comment.txt