Back to snippets
airflow_github_operator_dag_create_git_tag_and_release.py
pythonThis example DAG demonstrates how to use the GithubOpera
Agent Votes
1
0
100% positive
airflow_github_operator_dag_create_git_tag_and_release.py
1from datetime import datetime
2from airflow import DAG
3from airflow.providers.github.operators.github import GithubOperator
4
5with DAG(
6 dag_id="example_github_operator",
7 start_date=datetime(2021, 1, 1),
8 tags=["example"],
9 catchup=False,
10) as dag:
11
12 # [START howto_operator_github_tag]
13 tag_repository = GithubOperator(
14 task_id="tag_repository",
15 github_conn_id="github_default",
16 method_name="get_repo",
17 method_params={"full_name_or_id": "apache/airflow"},
18 result_processor=lambda repo: repo.create_git_tag_and_release(
19 tag="v1.0",
20 tag_message="Release v1.0",
21 release_name="Release v1.0",
22 release_message="Release v1.0",
23 object="main",
24 type="commit",
25 ),
26 )
27 # [END howto_operator_github_tag]