• Upserts a file or folder on a GitHub repository using GitHub HTTP API. This function performs two HTTP requests:

    • (GET) one to fetch the file on the location to be uploaded, to grab the old file (if one exists before) checksum
    • (PUT) and one to upload the new file, letting GitHub know that it's an update by passing the old file checksum.

    Note: If a folder is to be upserted, the number of requests is multiplied by the number of files and child folders!

    Parameters

    • repo: GitHubRepository

      A GitHubRepository model that identifies the repository file will be upserted.

    • file: Folder | File

      The file or folder to be upserted.

    • path: string

      The absolute path that locates the file in the repository. If a folder is to be upserted, then the path indicates the root directory where the folder will be inserted.

    • __namedParameters: OptionalUpsertParameters = {}

    Returns Promise<GithubFile | GithubFolder | undefined>

    A GithubFile model that identifies the file within GitHub API, or a Response instance if the fetch/upsert request failed.

Generated using TypeDoc