View Source Lightning.VersionControl (Lightning v2.10.4)
Boundary module for handling Version control activities for project, jobs workflows etc Use this module to create, modify and delete connections as well as running any associated sync jobs
Summary
Functions
Creates a connection between a project and a github repo
Deletes the authorization for the github app and updates the user details accordingly
Fetches the oauth access token using the code received from the callback url For more info: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app
Fecthes the access token for the given User
.
If the access token has expired, it refreshes
the token and updates the User
column accordingly
Checks if the given token has expired.
Github supports access tokens that expire and those that don't.
If the access token
expires, then a refresh token
is also availed.
This function simply checks if the token has a refresh_token
, if yes, it proceeds to check the expiry date
Fetches a new access token using the given refresh token For more info: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens
Deletes a github connection
Functions
@spec create_github_connection(map(), Lightning.Accounts.User.t()) :: {:ok, Lightning.VersionControl.ProjectRepoConnection.t()} | {:error, Ecto.Changeset.t() | Lightning.Extensions.UsageLimiting.message()}
Creates a connection between a project and a github repo
@spec delete_github_oauth_grant(Lightning.Accounts.User.t()) :: {:ok, Lightning.Accounts.User.t()} | {:error, map()}
Deletes the authorization for the github app and updates the user details accordingly
Fetches the oauth access token using the code received from the callback url For more info: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app
@spec fetch_user_access_token(Lightning.Accounts.User.t()) :: {:ok, String.t()} | {:error, map()}
Fecthes the access token for the given User
.
If the access token has expired, it refreshes
the token and updates the User
column accordingly
@spec initiate_sync( repo_connection :: Lightning.VersionControl.ProjectRepoConnection.t(), user_email :: String.t() ) :: :ok | {:error, Lightning.Extensions.UsageLimiting.message() | map()}
Checks if the given token has expired.
Github supports access tokens that expire and those that don't.
If the access token
expires, then a refresh token
is also availed.
This function simply checks if the token has a refresh_token
, if yes, it proceeds to check the expiry date
@spec reconfigure_github_connection( Lightning.VersionControl.ProjectRepoConnection.t(), map(), Lightning.Accounts.User.t() ) :: :ok | {:error, Lightning.Extensions.UsageLimiting.message() | map()}
Fetches a new access token using the given refresh token For more info: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens
Deletes a github connection
@spec save_oauth_token(Lightning.Accounts.User.t(), map(), [{:notify, boolean()}]) :: {:ok, Lightning.Accounts.User.t()} | {:error, Ecto.Changeset.t()}
@spec verify_github_connection( repo_connection :: Lightning.VersionControl.ProjectRepoConnection.t() ) :: :ok | {:error, Lightning.VersionControl.GithubError.t() | map()}