GitHubProject#
- class gafaelfawr.models.github_project.GitHubProject(*, id, template=None, description=None, requested_by=None, username, repository, repository_id, repository_owner_id, workflow=None, environment=None, ref=None, scopes, max_lifetime, uid=None, gid=None, groups=None, enabled, created, created_by, modified, modified_by)#
Bases:
BaseModelA registered GitHub project.
- Parameters:
Attributes Summary
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].Workflow as a full path, as in the
job_workflow_refclaim.Methods Summary
matches(claims)Whether a GitHub Actions ID token satisfies this project.
overlaps(other)Whether a GitHub Actions ID token could match both projects.
Attributes Documentation
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- workflow_path#
Workflow as a full path, as in the
job_workflow_refclaim.A workflow given as
.github/workflows/<file>is prefixed with the project repository, and one given as a full<owner>/<repo>/.github/workflows/<file>path is used as is. The repository part is lowercased, since repository names are matched case-insensitively, but the path part is not.
Methods Documentation
- matches(claims)#
Whether a GitHub Actions ID token satisfies this project.
A token matches when the project is enabled and every constraint the project sets is satisfied: the
repositoryclaim equals the project repository (case-insensitively) and therepository_idandrepository_owner_idclaims equal the pinned IDs; if a workflow is set, the path part ofjob_workflow_refequals it; if an environment is set, theenvironmentclaim equals it; and if a ref is set, therefclaim equals it or, when the ref ends in/, starts with it. Unset constraints match anything.- Parameters:
claims (
GitHubActionsClaims) – Claims of the verified token.- Returns:
Trueif the token satisfies every constraint of the project.- Return type:
- overlaps(other)#
Whether a GitHub Actions ID token could match both projects.
Two projects overlap when they are for the same repository and, for each of
workflow,environment, andref, the constraint is unset in at least one of them, the values are equal, or one ref is a prefix of the other.- Parameters:
other (
GitHubProjectCreate|Self) – Project to compare against, with its repository in the form GitHub reports it.- Returns:
Trueif some token could satisfy the constraints of both.- Return type: