Breakthrough-Energy / PowerSimData

Simulation framework
https://breakthrough-energy.github.io/docs/
MIT License
52 stars 40 forks source link

ci: prevent duplicate workflows #724

Closed jenhagg closed 1 year ago

jenhagg commented 1 year ago

Pull Request doc

Purpose

Prevent duplicate workflows after opening PRs. Currently we run one for push and pull_request events, which although technically different (since PRs use the pending merge commit vs branch head), that's not relevant as far as I know. We compare the base and head repo to ensure PRs from forks still run the checks (since those won't trigger a push event).

What the code is doing

Add condition to jobs which should prevent duplicates. Copy pasted from https://github.com/zopefoundation/meta/issues/145

Also removed the skip_ci feature since this is kinda builtin now: see https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs

Testing

Some testing here, although that doesn't test the forked repo scenario: https://github.com/jenhagg/test-ci/pull/6

Time estimate

5 min