Checks that the tokens required for this job to run are available in the environment. A GitHub token is always required. A Slack token is required only if a `slack_channel` is specified. :param slack_channel: Channel to publish the digest. Publish step is skipped if this is an empty
(slack_channel: str = "")
| 353 | |
| 354 | |
| 355 | def token_verification(slack_channel: str = ""): |
| 356 | """ |
| 357 | Checks that the tokens required for this job to run are available in the environment. |
| 358 | |
| 359 | A GitHub token is always required. A Slack token is required only if a `slack_channel` is specified. |
| 360 | |
| 361 | :param slack_channel: Channel to publish the digest. Publish step is skipped if this is an empty string. |
| 362 | :raises AuthenticationError: When required token is missing from the environment. |
| 363 | """ |
| 364 | if not os.environ.get("GITHUB_TOKEN", ""): |
| 365 | raise AuthenticationError("Required GitHub token not found in environment.") |
| 366 | if slack_channel and not os.environ.get("SLACK_TOKEN", ""): |
| 367 | raise AuthenticationError("Slack token must be included in environment if Slack channel is provided.") |
| 368 | |
| 369 | |
| 370 | def start_job(): |
no test coverage detected