Skip to content

Merge pull request #399 from staceypotter/patch-6 #29

Merge pull request #399 from staceypotter/patch-6

Merge pull request #399 from staceypotter/patch-6 #29

Workflow file for this run

name: Push to Website
# When a change comes in the main branch on any of the files listed as
# external-sources in the fluxcd/website repository, trigger a rebuild
# without delay. The rebuild is scheduled for once every 6 hours. With
# this automation, the rebuild should proceed immediately after a PR is
# merged to the fluxcd/community repo, only if it changes one of these.
#
# Combination of example workflows:
# https://how.wtf/run-workflow-step-or-job-based-on-file-changes-github-actions.html
# https://medium.com/hostspaceng/triggering-workflows-in-another-repository-with-github-actions-4f581f8e0ceb
#
# This workflow monitors the "main" branch for changes to any of the files in
# community repo that are listed as "external-sources" in the fluxcd/website
# repo, then upon detecting changes fires the "Netlify" workflow in website
# to trigger rebuild of https://fluxcd.io (and redeploy of the said content)
on:
#
# workflow-dispatch: # NB: this is disabled on-purpose. The push filter conflicts with workflow-dispatch
# # because there is no push event to filter changes based upon. If you want to trigger
# # the netlify job in fluxcd/website, go trigger it directly. (You may need access!)
# # There is no manual workflow-dispatch here, this workflow is for better automation.
# # The fluxcd/website#netlify job also will rebuild itself on a schedule (*/6 hours)
#
push:
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
outputs:
external: ${{ steps.changes.outputs.external }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
external:
- 'README.md'
- 'GOVERNANCE.md'
- 'KUBECON.md'
trigger:
needs: changes
if: ${{ needs.changes.outputs.external == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Trigger fluxcd/website#netlify workflow
run: |
# Set the required variables
repo_owner="fluxcd"
repo_name="website"
event_type="trigger-workflow"
service=netlify
version=main
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.BOT_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"service\": \"$service\", \"version\": \"$version\", \"unit\": false, \"integration\": true}}"