Documentation ¶
Overview ¶
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
git provides functions for interacting with GitHub repositories, including cloning repositories, adding collaborators, uploading files, and creating releases.
Index ¶
- func AddCollaborator(repoID string, username string, permission string) (err error)
- func Clone(repoURL string, targetDirectory string) (err error)
- func Create(name string, withWebhook bool, additionalBranches ...string) (err error)
- func GetDecodedFile(repoID string, branch string, filePath string) (content string, err error)
- func NewRelease(repoID string, tagName string, releaseName string, tracesPath string, ...) (err error)
- func RepoExists(repo string) (exists bool, err error)
- func UploadFile(repoID string, localFilePath string, targetFilePath string, ...) (err error)
- func UploadRaw(repoID string, data string, targetFilePath string, commitMessage string, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCollaborator ¶
AddCollaborator adds a collaborator with the specified permissions to the repository.
- repoID: the name of the organization repository
- username: the GitHub username of the collaborator
- permission: the access level to be given to the user
NOTE: Using this function will overwrite the user's previous rights. Use test accounts, or you might lock yourself out of your repos.
Returns an error if the process of adding the collaborator fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
func Clone ¶
Clone clones a GitHub repository from the specified repoURL into the targetDirectory.
- repoURL: the URL of the repository to clone
- targetDirectory: the directory where the repository should be cloned
Returns an error if the cloning process fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
func Create ¶
Create checks if a repository exists, and if not, creates it under the configured organization. It also adds a webhook for easy recording of repository activity.
- name: the name of the repository to create
- withWebhook: bool indicating whether to add a webhook to the repo, allowing the server to listen for changes
- additionalBranches: variadic list of branches you would like to be created
Returns an error if the repository creation process fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
func GetDecodedFile ¶
GetDecodedFile retrieves the decoded content of a file from the specified repository, branch, and file path as a string.
- repoID: the name of the organization repository
- branch: the branch to pull the file from
- filePath: the path to the file on the remote repository
Returns the file content as a string and an error if the retrieval process fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
func NewRelease ¶
func NewRelease(repoID string, tagName string, releaseName string, tracesPath string, graded bool) (err error)
NewRelease adds a release to the specified repository with the provided tagName and releaseName. It also adds the path to the traces and the last graded timestamp to the release body if graded is set to true.
- repoID: the name of the organization repository
- tagName: the tag under which the release is to be created
- releaseName: the name/title of the release
- tracesPath: the path to the traces, used for adding a link to them in the release body
- graded: if set to true, the last graded timestamp in the release will be updated
Returns an error if the release creation process fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
func RepoExists ¶
RepoExists checks if a GitHub repository exists for the given repo name.
- repo: the name of the repository to check
Returns a boolean indicating whether the repository exists and an error if the check fails.
func UploadFile ¶
func UploadFile(repoID string, localFilePath string, targetFilePath string, commitMessage string, branch string) (err error)
UploadFile adds or updates a file on a repository.
- repoID: the name of the organization repository
- localFilePath: the source file to be uploaded
- targetFilePath: the file to be created/updated on the remote
- commitMessage: the message to be added to the commit
- branch: the branch to push the data to
Returns an error if the file upload process fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
func UploadRaw ¶
func UploadRaw(repoID string, data string, targetFilePath string, commitMessage string, branch string) (err error)
UploadRaw uploads raw data directly to the specified targetFilePath in the repository.
- repoID: the name of the organization repository
- data: the raw data to be uploaded as a string
- targetFilePath: the file to be created/updated on the remote
- commitMessage: the message to be added to the commit
- branch: the branch to push the data to
Returns an error if the data upload process fails.
See https://github.com/42-Short/shortinette/README.md for details on GitHub configuration.
Types ¶
This section is empty.