diff --git a/README.md b/README.md index 9ef0ec4..a8dce58 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,22 @@ By deploying a GitHub App and asking their students to install this app on their 1) You need to [create a GitHub App](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app) in your organization or personal account on GitHub 2) For GCP cloud run deployment, you may need to install terraform and the gcloud CLI. +## GitHub App + +Your GitHub App needs the following informations : + +### Repository permissions +- Actions: RO +- Checks: RW # create a check on PR +- Issues: RW # comment the issue +- Contents: RO +- Pull requests: RW # comment the issue + +### Subscribe to events +- Pull request +- Push +- Workflow job + ## Deploy locally You first need to create a `.env` file by filling up the values from the `.env.template` file. diff --git a/github_tests_validator_app/config.py b/github_tests_validator_app/config.py index 40cf6d3..2bc54f2 100644 --- a/github_tests_validator_app/config.py +++ b/github_tests_validator_app/config.py @@ -6,7 +6,7 @@ import google.cloud.logging import yaml -if os.getenv("LOGGING", "") == "GCP": +if os.getenv("LOGGING", "").replace("\r\n", "") == "GCP": logging_client = google.cloud.logging.Client() logging_client.get_default_handler() logging_client.setup_logging() @@ -23,17 +23,19 @@ logging.getLogger("uvicorn").removeHandler(logging.getLogger("uvicorn").handlers[0]) # GitHub -GH_APP_ID = cast(str, os.getenv("GH_APP_ID", None)) +GH_APP_ID = cast(str, os.getenv("GH_APP_ID", None)).replace("\r\n", "") GH_APP_KEY = cast(str, os.getenv("GH_APP_KEY", None)) -GH_PAT = cast(str, os.getenv("GH_PAT", None)) -GH_TESTS_REPO_NAME = cast(str, os.getenv("GH_TESTS_REPO_NAME", None)) +GH_PAT = cast(str, os.getenv("GH_PAT", None)).replace("\r\n", "") +GH_TESTS_REPO_NAME = cast(str, os.getenv("GH_TESTS_REPO_NAME", "")).replace("\r\n", "") GH_TESTS_FOLDER_NAME = "tests" GH_WORKFLOWS_FOLDER_NAME = ".github/workflows" GH_API = "https://api.github.com/repos" GH_ALL_ARTIFACT_ENDPOINT = "actions/artifacts" # Google Drive -GDRIVE_MAIN_DIRECTORY_NAME = cast(str, os.getenv("GDRIVE_MAIN_DIRECTORY_NAME", None)) +GDRIVE_MAIN_DIRECTORY_NAME = cast(str, os.getenv("GDRIVE_MAIN_DIRECTORY_NAME", "")).replace( + "\r\n", "" +) # Google Sheet GDRIVE_HIERARCHY_PATH = "github_tests_validator_app/data/gdrive_hierarchy.yml" @@ -60,4 +62,4 @@ # Common CHALLENGE_DIR = "tests/tests/" DATE_FORMAT = "%d/%m/%Y %H:%M:%S" -USER_SHARE = os.getenv("USER_SHARE", "").split(",") +USER_SHARE = os.getenv("USER_SHARE", "").replace("\r\n", "").split(",")