Skip to content

Commit 9ab430d

Browse files
authored
Trigger slack notification workflow in theme repo (#574)
* feat: Add a new trigger to build push workflow * feat: Add additional job to trigger slack notification * feat: Updated code to use environment from payload if inputs does not exist * feat: Add permissions * chore: Remove redoc layout * chore: Moved owner + repo to env variable for slack job * chore: Updated with passing client payload for release metadata * chore: Changed PAT to F5 + moved owner/repo to secrets
1 parent 6bb9f12 commit 9ab430d

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/build-push.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ on:
4141
env:
4242
FRONT_DOOR_USERNAME: ${{ secrets.FRONT_DOOR_USERNAME }}
4343
FRONT_DOOR_PASSWORD: ${{ secrets.FRONT_DOOR_PASSWORD }}
44-
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
44+
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
4545
jobs:
4646
prod-check-branch:
4747
runs-on: ubuntu-24.04
4848
steps:
4949
- name: Output variables
5050
run: |
51-
echo "Environment: ${{ inputs.environment }}"
51+
echo "Environment: ${{ inputs.environment || github.event.client_payload.environment }}"
5252
echo "Branch: ${{ github.ref }}"
5353
- name: Checks to see that main branch is selected if deploying to prod
5454
if: ${{ inputs.environment == 'prod' && github.ref != 'refs/heads/main' }}
@@ -65,14 +65,33 @@ jobs:
6565
docs_source_path: "public"
6666
docs_build_path: "./"
6767
doc_type: "hugo"
68-
environment: ${{inputs.environment}}
68+
environment: ${{ inputs.environment || github.event.client_payload.environment }}
6969
force_hugo_theme_version: ${{inputs.hugo_theme_override}}
7070
auto_deploy_branch: "main"
7171
auto_deploy_env: "prod"
7272
secrets:
7373
AZURE_CREDENTIALS: ${{secrets.AZURE_CREDENTIALS_DOCS}}
7474
AZURE_KEY_VAULT: ${{secrets.AZURE_KEY_VAULT_DOCS}}
7575

76+
trigger-theme-slack-notification:
77+
if: github.event_name == 'repository_dispatch'
78+
needs: call-docs-build-push
79+
runs-on: ubuntu-latest
80+
permissions: read-all
81+
steps:
82+
- name: Trigger 'Slack notification for new theme release' workflow in 'nginx-hugo-theme' repo.
83+
run: |
84+
curl -L \
85+
-X POST \
86+
-H "Accept: application/vnd.github+json" \
87+
-H "Authorization: Bearer ${{ secrets.F5_CLA_TOKEN }}" \
88+
-H "X-GitHub-Api-Version: 2022-11-28" \
89+
"https://api.github.com/repos/${{ secrets.OWNER }}/${{ secrets.REPO }}/dispatches" \
90+
-d "{"event_type": "trigger-slack-notification", "client_payload": {"previewURL": "${{ env.PREVIEW_URL }}", "author": "${{ github.event.client_payload.author}}", "tag_name": "${{ github.event.client_payload.tag_name }}", "release_name": "${{ github.event.client_payload.release_name }}"}}"
91+
env:
92+
PREVIEW_URL: ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}
93+
94+
7695
lighthouseci:
7796
if: github.event.pull_request
7897
needs: call-docs-build-push

0 commit comments

Comments
 (0)