machow / siuba

Python library for using dplyr like syntax with pandas and SQL
https://siuba.org
MIT License
1.16k stars 49 forks source link

Don't run github actions twice on pull requests #389

Closed machow closed 2 years ago

machow commented 2 years ago

Currently, our CI github triggers github actions on all pushes and pull_request events. The haunting issue with this is that it runs PRs made from branches on this repo twice (Note that for PRs opened from forks it will run once).

name: CI

on:
  push:
  pull_request:
  release:
    types: [published]

Changing to only run pull requests, and pushes to main works well, if you open draft PRs for all branches you want to test. However, sometimes I want to run github actions while testing things out (not necessarily worth opening a draft PR).

A compromise might be:

classic approach

customization

  workflow_dispatch:
  push:
    branches: ['main', 'dev-*']
  pull_request:
  release:
    types: [published]
machow commented 2 years ago

Note that this was solved in an even better way in https://github.com/rstudio/pins/blob/main/.github/workflows/rstudio-connect.yaml#L12!

if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false