Skip to content

📡 Github Action to auto-comment on pull request where the actions took place

Notifications You must be signed in to change notification settings

ssskram/now-deploy-preview-comment

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

now-deploy-preview-comment

Github action to comment with the now.sh deployment preview URL

Inspired by netlify.com deployment preview comments

Result

preview

Requirements

  • ZEIT_TOKEN => The token used for deployment and query the zeit.co API
  • ZEIT_TEAMID => This is required if your deployment is made on team project.
  • PROJECT_ID => This is required to ensure deployments are only referenced for a specific project.
  • meta-commit => Add the SHA commit to the meta of the deployment (-m commit=${GITHUB_SHA})
  • meta-branch => Add the ref/branch to the meta of the deployment (-m commit=${GITHUB_REF})

Example

  • This is a complete .github/workflow/deploy-preview.yml example.
  • Be sure to include -m commit=${GITHUB_SHA} -m branch=${GITHUB_REF} in the now deploy command or the pull request comment will fail.
name: deploy website preview
on: [pull_request]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: deploy now
        env:
          ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
        run: now --no-clipboard -t ${ZEIT_TOKEN} -m commit=${GITHUB_SHA} -m branch=${GITHUB_REF}
      - uses: iam4x/now-deploy-preview-comment@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
          ZEIT_TEAMID: team_XXXXXXXXXXX

License WTFPL2

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.

About

📡 Github Action to auto-comment on pull request where the actions took place

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 66.8%
  • Dockerfile 33.2%