3b1b/3Blue1Brown.com

Sync action race condition

kurtbruns opened this issue · 2 comments

If multiple commits are made to main in quick succession that have different assets, then the last one to finish is going to reflect the state the bucket is left in. This is a problem because we only want the last commit's run and the run time of a workflow seems to vary between 1-4 mins. I think the solution is to use something like: https://github.com/styfle/cancel-workflow-action

The workflows/sync-assets.yaml file would be modified to have the cancel job before the other job that either clears out all workflows or specifically the sync workflow.

jobs:
  cancel:
    runs-on: ubuntu-latest
    steps:
      - name: Cancel Previous Runs
        uses: styfle/cancel-workflow-action

Would the built in concurrency option be enough here?

At a glance, the concurrency option looks like it will work if you also specify cancel-in-progress: true