Trigger GitHub action when GitHub page is published

Viewed 136

I have a Github page that automatically gets updated when I push to master. I would like to run a Github action that would trigger when the website gets published.

This would allow me to get the updated RSS feed and update my social media accounts anytime I push a change to the website.

Is it possible to run a Github action when the website changes and after it is published? Or is it possible to turn off the GitHub page publishing and create a workflow that I have control of and publish myself?

1 Answers

GitHub Pages uses deployments to publish. The following workflow will trigger when a deployment was successful allowing you to update what you need to afterwards.

on: deployment_status
jobs:
  publish:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      ...
Related