The pushpreview-action is a GitHub Action designed to automate the creation of previews for web projects or applications using the PushPreview platform.
To start using the pushpreview-action, follow the steps outlined in our Quickstart.
Below is an example of how to use the push-preview-action in a workflow:
name: PushPreviewon:
pull_request_target:
types:
- labeledjobs:
preview:
runs-on: ubuntu-latestif: github.event.label.name == 'preview'steps:
- uses: actions/checkout@v3
- name: Commentrun: | gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "⚙️ Hang tight! PushPreview is currently building your preview. We'll share the URL as soon as it's ready."env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3with:
node-version: 18
- name: Set BASE_URLrun: echo "BASE_URL=/github/${{ github.repository }}/${{ github.event.number }}/" >> $GITHUB_ENV# Replace with your docs build commands
- name: Build siterun: | cd docs yarn install --frozen-lockfile yarn build - name: Generate previewuses: TechDocsStudio/pushpreview-action@1.0.6with:
# Replace with your docs output directorysource-directory: ./docs/buildgithub-token: ${{ secrets.GITHUB_TOKEN }}pushpreview-token: ${{ secrets.PUSHPREVIEW_TOKEN }}For more information, refer to the Installation section for CMS-specific guides.
This action requires the following inputs:
source-directory
- Description: The directory to compress and send.
- Required: Yes
github-token
- Description: The secret token of GitHub.
- Required: Yes
pushpreview-token
- Description: The secret token for the PushPreview API.
- Required: Yes
The action provides the following output:
- comment
- Description: PushPreview comment with links for every change edited and the URL of the preview.
The action uses the following secrets:
GITHUB_TOKEN: This is a GitHub secret used to authenticate and interact with GitHub APIs.PUSHPREVIEW_TOKEN: This is a secret token for the PushPreview API, necessary for authentication and authorization.
Need assistance? Contact our support team for help.