{"id":6986,"library":"apache-airflow-providers-github","title":"Apache Airflow GitHub Provider","description":"The `apache-airflow-providers-github` package provides Apache Airflow integrations for interacting with GitHub. It enables users to perform various GitHub operations, such as managing repositories, issues, pull requests, and other Git-related tasks directly from Airflow workflows. This active provider, currently at version 2.11.2, is part of Airflow's modular provider ecosystem, allowing for independent releases and updates from the core Airflow project.","status":"active","version":"2.11.2","language":"en","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/github","tags":["airflow","provider","github","integration","automation","devops"],"install":[{"cmd":"pip install apache-airflow-providers-github","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Airflow functionality is required.","package":"apache-airflow","version":">=2.11.0"},{"reason":"Used as the underlying GitHub SDK for API interactions.","package":"PyGithub","version":">=2.1.1"},{"reason":"Optional dependency for `common.compat` extra, providing compatibility utilities.","package":"apache-airflow-providers-common-compat","version":">=1.10.1","optional":true}],"imports":[{"symbol":"GithubOperator","correct":"from airflow.providers.github.operators.github import GithubOperator"},{"note":"Avoid repeating 'github' in the path. The correct path is directly under `airflow.providers.github`.","wrong":"from airflow.providers.github.github.sensors.github import GithubSensor","symbol":"GithubSensor","correct":"from airflow.providers.github.sensors.github import GithubSensor"},{"symbol":"GithubHook","correct":"from airflow.providers.github.hooks.github import GithubHook"}],"quickstart":{"code":"import os\nfrom datetime import datetime\n\nfrom airflow.models.dag import DAG\nfrom airflow.providers.github.operators.github import GithubOperator\n\nwith DAG(\n    dag_id='github_create_issue_example',\n    start_date=datetime(2023, 1, 1),\n    schedule=None,\n    catchup=False,\n    tags=['github', 'example', 'issue'],\n    doc_md=\"\"\"### GitHub Create Issue Example\n    This DAG demonstrates creating a GitHub issue using the GithubOperator.\n    Ensure you have a GitHub connection configured with `conn_id='github_default'`\n    and a Personal Access Token with 'repo' scope.\n\n    Environment variables:\n    - GITHUB_REPO_OWNER: Owner of the repository (e.g., 'apache')\n    - GITHUB_REPO_NAME: Name of the repository (e.g., 'airflow')\n    \"\"\",\n) as dag:\n    create_github_issue = GithubOperator(\n        task_id='create_github_issue',\n        github_conn_id='github_default',\n        method_name='create_issue',\n        repository_name=f\"{os.environ.get('GITHUB_REPO_OWNER', 'test-user')}/{os.environ.get('GITHUB_REPO_NAME', 'test-repo')}\",\n        title='Airflow created issue from DAG',\n        body='This issue was automatically created by an Airflow DAG.',\n        assignees=['{AIRFLOW_GITHUB_ASSIGNEE}'], # Optional: Replace with a valid GitHub username for your repo\n        labels=['bug', 'airflow-automation'],\n        # Optional: You can pass other arguments supported by PyGithub's create_issue method\n        # e.g., 'milestone': 1,\n    )\n","lang":"python","description":"This quickstart demonstrates how to use the `GithubOperator` to create a new issue in a specified GitHub repository. Before running, configure an Airflow connection of type 'GitHub' with `conn_id='github_default'`. The 'GitHub Access Token' field should contain a Personal Access Token (PAT) with `repo` scope. Set the `GITHUB_REPO_OWNER` and `GITHUB_REPO_NAME` environment variables (or hardcode for testing) to point to your target repository. Optionally, set `AIRFLOW_GITHUB_ASSIGNEE` to assign the issue."},"warnings":[{"fix":"Always check the `apache-airflow-providers-github` documentation for the `Requirements` section to verify the compatible Airflow version. Upgrade `apache-airflow` to the specified minimum version or install an older, compatible provider version.","message":"Provider versions frequently update their minimum required Apache Airflow version. Installing a new provider version with an older Airflow core can lead to incompatibility errors or unexpected behavior.","severity":"breaking","affected_versions":"<2.11.0 of apache-airflow for provider >=2.11.x"},{"fix":"Ensure the GitHub connection in Airflow (Admin -> Connections) is of `Connection Type: GitHub`. For PAT-based authentication, the 'GitHub Access Token' (password field) must have the necessary scopes (e.g., 'repo' for issue management). For GitHub App authentication, correctly populate the 'Extras' field with `key_path`, `app_id`, and `installation_id`.","message":"Incorrect GitHub connection configuration, especially regarding authentication. Users often provide insufficient permissions for the Personal Access Token (PAT) or incorrectly configure GitHub App authentication details.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review the Airflow task logs for the underlying `GithubException` message. Verify the parameters passed to the operator (e.g., `repository_name`, `assignees`, `labels`) are valid within your GitHub context and that the configured GitHub connection has the appropriate permissions for the action being performed.","message":"Common `PyGithub` exceptions wrapped by `AirflowException` when interacting with the GitHub API. This usually indicates an issue with API calls such as invalid repository names, non-existent users for assignment, or insufficient permissions on the GitHub side.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install apache-airflow-providers-github` to install the provider. If running in a Dockerized environment, rebuild your Docker image after adding the package to your `requirements.txt` or install command.","cause":"The `apache-airflow-providers-github` package is not installed in the Airflow environment, or Python cannot find it.","error":"ModuleNotFoundError: No module named 'airflow.providers.github.operators.github'"},{"fix":"In the Airflow UI, navigate to Admin -> Connections, edit your GitHub connection, and ensure the 'GitHub Access Token' (password field) is a valid, active token with all required scopes (e.g., 'repo' scope for creating issues or interacting with repositories).","cause":"The GitHub connection (e.g., `github_default`) uses a Personal Access Token that is invalid, expired, or does not have the necessary scopes (permissions) for the operation being attempted.","error":"Failed to execute GithubOperator, error: 401 {'message': 'Bad credentials' ...}"},{"fix":"Verify the `repository_name`, `assignees`, `tag_name`, or other resource-specific parameters in your operator or sensor are correct and accessible by the GitHub account associated with the Airflow connection.","cause":"The specified GitHub repository, user, or resource (e.g., a specific issue number or tag) does not exist or is inaccessible to the authenticated GitHub user/app.","error":"Failed to execute GithubOperator, error: 404 {'message': 'Not Found' ...}"}]}