Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 8 additions & 6 deletions github_tests_validator_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"
Expand All @@ -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(",")