Skip to content

Rename ods to tods #104

Rename ods to tods

Rename ods to tods #104

name: Netlify MkDocs Previews
on:
pull_request_target:
paths:
- "docs/**"
jobs:
deploy-preview:
# If the PR is coming from a branch in this repo, allow it to run. If it's
# from a fork, then require the "deploy-preview" label to exist
# https://git.io/JsVv1
if: "!github.event.repository.fork || (github.event.repository.fork && contains(github.event.pull_request.labels.*.name, 'deploy-preview'))"
name: Deploy Netlify Preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Build MkDocs website
run: |
pip install -r docs/requirements.txt
mkdocs build
- name: Install Netlify CLI
run: npm install -g [email protected]
# Don't expose secrets to any other process other than the `netlify` cli;
# don't risk rogue dependencies pulling our secrets
- name: Deploy Preview to Netlify
run: |
netlify deploy \
--alias="${GITHUB_REPOSITORY#*/}-${{ github.event.number }}" \
--auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \
--dir="site" \
--site=${{ secrets.NETLIFY_PREVIEW_APP_SITE_ID }}
- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.number }}
comment-author: "github-actions[bot]"
body-includes: "Preview url: https://"
- name: Add Netlify link PR comment
uses: actions/github-script@v3
if: steps.find-comment.outputs.comment-id == ''
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const hostnameSuffix = "cal-itp-previews.netlify.app"
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Preview url: https://${context.repo.repo}-${{ github.event.number }}--${hostnameSuffix}`,
})