ploomber / soorgeon

Convert monolithic Jupyter notebooks 📙 into maintainable Ploomber pipelines. 📊
https://ploomber.io
Apache License 2.0
78 stars 20 forks source link

add branch filter for push ci #76

Closed Wxl19980214 closed 2 years ago

Wxl19980214 commented 2 years ago

Describe your changes

Added a branch filter for push ci

Only push to main branch will trigger workflow, push to other develop branch will not.

For example, only push to ploomber/soorgeon main will trigger workflow, push to ploomber/soorgeon 3-10 will not.

Same in the forked repo. Push to Wxl19980214/soorgeon main will trigger workflow in Wxl19980214/soorgeon.

It fixes double execution of workflow when there existing a PR for a develop branch and someone push to that branch because only pull request will trigger workflow now. Each time a branch associated with a PR gets updated, only one workflow will triggered by pull_request event.

Checklist before requesting a review

edublancas commented 2 years ago

Interesting, I've seen these duplicated workflows but I never stopped to think about how to fix them.

Sometimes when I develop stuff, I create a new branch and push to test the changes, so I think we should still enable it for some branches.

I saw this: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#using-filters

let's enable it for the dev prefix, this way I can still create dev branches to test:

on:
  push:
    branches:
      - main
      - 'dev/**'
idomic commented 2 years ago

@Wxl19980214 can you please open a dummy PR and check behavior?