Home > Back-end >  Airflow Sensor Operator - github PR
Airflow Sensor Operator - github PR

Time:01-28

Would it be possible to config an Airflow sensor (thinking maybe the @task.sensor decorator sensor) that could listen for a PR to be merged in a Github repo and trigger the DAG run based on that? Ideally outside of using Github Actions.

CodePudding user response:

Airflow sensors are just python classes, they should have a method poke which return True when the thing you want to wait happens.

To achieve what you want to do, you can use the library PyGithub, to get the state of the PR and return True when it is merged (and fail when it is closed).

Here is the link to the doc, and the source code if there is something not documented.

  • Related