Add docs to enable integration of new services #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger website build on docs change | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
pull_request: | |
paths: | |
- 'docs/**' | |
jobs: | |
# Job to dispatch a production build event when changes are pushed to the 'main' branch | |
production-build: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 # Fetch the last two commits for context | |
- name: Get merged PR number | |
id: get-pr-number | |
run: | | |
# Extract the PR number from the latest commit message if available | |
PR_NUMBER=$(git log -1 --pretty=format:'%s' | grep -oP '#\K\d+' || echo "") | |
if [ -n "$PR_NUMBER" ]; then | |
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
else | |
echo "No PR number found in the commit message" | |
fi | |
- name: Dispatch Production Build Event | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
repository: anynines/klutchio-website | |
event-type: docs-updated-on-main | |
client-payload: > | |
{ | |
"pr_number": "${{ steps.get-pr-number.outputs.pr_number }}", | |
"repo": "${{ github.repository }}", | |
"sha": "${{ github.sha }}" | |
} | |
# Job to dispatch a preview build event for PRs affecting the docs | |
preview-build: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Dispatch PR Preview Event | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
repository: anynines/klutchio-website | |
event-type: preview-docs-pr | |
client-payload: > | |
{ | |
"pr_number": "${{ github.event.number }}", | |
"repo": "${{ github.repository }}", | |
"sha": "${{ github.event.pull_request.head.sha }}" | |
} |