This blog is generated using Jekyll and hosted Azure as a Static Web Site. That means that all of my posts are written as HTML, commited to a GitHub repo, and then pushed to Azure.
For the past few months, I've had the default GitHub Action in place to build and deploy the site.
name: Azure Static Web Apps CI/CD on: push: branches: - main pull_request: types: [opened, synchronize, reopened, closed] branches: - mainBasically, this action will run only when pushes are done directly to main, or when a PR is manipulated. The fact is, when I pushed the .gitignore file, it was straight to main, so I knew it would trigger a completely unnecessary build and deployment.
I learned how to ignore files and folders so they won't trigger the action. It's actually really simple - just add paths-ignore and specifications for what you want to ignore. In my case, I never want the action to run if I commit my .gitignore or anything in my _drafts folder.
on: push: branches: - master paths-ignore: - '.gitignore' - '_drafts/**' pull_request: types: [opened, synchronize, reopened, closed] branches: - masterIt should be noted that you can add a paths section to do the inverse - only have it trigger when certain files or folders are modified and commited.
For more workflow syntax, check the docs.