Skip to content

Trigger slack notification workflow in theme repo #574

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

Merged
merged 8 commits into from
May 22, 2025
25 changes: 23 additions & 2 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Build and deploy (docs)
on:
repository_dispatch:
types: [trigger-preview-build]
workflow_call:
inputs:
environment:
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:
steps:
- name: Output variables
run: |
echo "Environment: ${{ inputs.environment }}"
echo "Environment: ${{ inputs.environment || github.event.client_payload.environment }}"
echo "Branch: ${{ github.ref }}"
- name: Checks to see that main branch is selected if deploying to prod
if: ${{ inputs.environment == 'prod' && github.ref != 'refs/heads/main' }}
Expand All @@ -63,14 +65,33 @@ jobs:
docs_source_path: "public"
docs_build_path: "./"
doc_type: "hugo"
environment: ${{inputs.environment}}
environment: ${{ inputs.environment || github.event.client_payload.environment }}
force_hugo_theme_version: ${{inputs.hugo_theme_override}}
auto_deploy_branch: "main"
auto_deploy_env: "prod"
secrets:
AZURE_CREDENTIALS: ${{secrets.AZURE_CREDENTIALS_DOCS}}
AZURE_KEY_VAULT: ${{secrets.AZURE_KEY_VAULT_DOCS}}

trigger-theme-slack-notification:
if: github.event_name == 'repository_dispatch'
needs: call-docs-build-push
runs-on: ubuntu-latest
permissions: read-all
steps:
- name: Trigger 'Slack notification for new theme release' workflow in 'nginx-hugo-theme' repo.
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/nginxinc/nginx-hugo-theme/dispatches" \
-d "{"event_type": "trigger-slack-notification", "client_payload": {"previewURL": "${{PREVIEW_URL}}"}}"
env:
PREVIEW_URL: ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}


lighthouseci:
if: github.event.pull_request
needs: call-docs-build-push
Expand Down