Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update draft dispatch workflow #182

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 3 additions & 27 deletions .github/workflows/dispatch-deploy-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,19 @@ name: Deploy Draft
on:
pull_request:
branches:
- '*'
- '**'

jobs:
dispatch-deploy:
runs-on: ubuntu-latest

steps:
# Determine the build branch and draft branch for dispatch.
- name: Determine Dispatch Parameters
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
# If this workflow is kicked off by a pull request, build
# a draft using the pull request base branch and PR branch.
build_branch="${{ github.base_ref }}"
draft_branch="${{ github.event.pull_request.head.ref }}"
else
if [ "$(basename ${{ github.event.ref }})" == "stage" ]; then
# This was a merge to stage so kick off a build to update stage draft.
build_branch=stage
draft_branch=stage
else
# Otherwise this is a push to one of the source branches so
# dispatch a build for the main draft to pick up the changes.
build_branch=main
draft_branch=main
fi
fi
echo "build_branch=$build_branch" >> $GITHUB_OUTPUT
echo "draft_branch=$draft_branch" >> $GITHUB_OUTPUT
id: branches

- name: Deploy Draft
uses: convictional/trigger-workflow-and-wait@v1.6.1
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: riptano
repo: datastax-docs-site
github_token: ${{ secrets.DISPATCH_GITHUB_TOKEN }}
github_user: ${{ secrets.DISPATCH_GITHUB_USER }}
workflow_file_name: deploy-draft.yml
client_payload: '{ "build_repository": "${{ github.event.repository.full_name }}", "build_branch": "${{ steps.branches.outputs.build_branch }}", "draft_branch": "${{ steps.branches.outputs.draft_branch }}", "pull_request_number": "${{ github.event.pull_request.number }}" }'
client_payload: '{ "build_repository": "${{ github.event.repository.full_name }}", "build_branch": "${{ github.base_ref }}", "draft_branch": "${{ github.event.pull_request.head.ref }}", "pull_request_number": "${{ github.event.pull_request.number }}" }'
Loading