Skip to content

Instantly share code, notes, and snippets.

@skullface
Last active March 19, 2023 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skullface/87e4679148f6b8cebe657f7c270c8fbe to your computer and use it in GitHub Desktop.
Save skullface/87e4679148f6b8cebe657f7c270c8fbe to your computer and use it in GitHub Desktop.
GitHub action to edit pull request with Vercel preview deploy URL for the branch
name: Link to Vercel preview deploy
on:
pull_request:
types: [opened]
jobs:
update-pr:
runs-on: ubuntu-latest
steps:
- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
id: extract_branch
- name: Append PR body with preview deploy URL
uses: devindford/Append_PR_Comment@v1.1.2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
body-template: |
---
🔗 **Preview**: https://<project-name>-git-${{ env.BRANCH_NAME }}.<scope-slug>.vercel.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment