Skip to content

Trigger Build pkgdown Site #56

Trigger Build pkgdown Site

Trigger Build pkgdown Site #56

name: Trigger Build pkgdown Site
on:
workflow_run:
workflows: ["Increment version"] # Ensure this matches the name in increment_version.yaml
types:
- completed
workflow_dispatch:
jobs:
trigger-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install GitHub CLI
run: |
sudo apt update
sudo apt install -y gh
- name: Configure GitHub CLI
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Trigger Build pkgdown site
run: |
# Determine the branch name based on the event type
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
# If triggered by a workflow_run, use the head_ref from the triggering workflow
BRANCH_NAME=${{ github.event.workflow_run.head_branch }}
else
# For other events, use the ref
BRANCH_NAME=${GITHUB_REF##*/}
fi
echo "Triggering Build pkgdown site on branch: $BRANCH_NAME"
gh workflow run "Build pkgdown site" --ref "$BRANCH_NAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}