Trigger Build pkgdown Site #64
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 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 | |
if: github.event.workflow_run.conclusion == 'success' && github.event_name == 'workflow_run' # Conditional check | |
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 }} |