My original plan was to have two jobs in the same workflow which talked to each other, and one of the jobs (to commit the fonts) would only run if the sources changed. But actually we can't do that: we can't put on: paths: sources on a job, only on a workflow. So instead, we use a third-party action (https://github.com/dorny/paths-filter) to check which paths changed in the PR/push, and set a variable to true if the sources changed. Then we can make the "commit build fonts" step conditional on this variable.
The original action file was taken from googlefonts-project-template and so it was written in a way that would work in any repository. Since this is now specialised for Playwrite, we can simplify it a bit. I've also added some comments and step names to make it a bit clearer.
My original plan was to have two jobs in the same workflow which talked to each other, and one of the jobs (to commit the fonts) would only run if the sources changed. But actually we can't do that: we can't put
on: paths: sources
on a job, only on a workflow. So instead, we use a third-party action (https://github.com/dorny/paths-filter) to check which paths changed in the PR/push, and set a variable to true if the sources changed. Then we can make the "commit build fonts" step conditional on this variable.The original action file was taken from googlefonts-project-template and so it was written in a way that would work in any repository. Since this is now specialised for Playwrite, we can simplify it a bit. I've also added some comments and step names to make it a bit clearer.