How to create a commit, on newly created empty repository using GitHub Graphql API

How to create a commit, on newly created empty repository using GitHub Graphql API


0

GraphQL Query I used:

mutation CreateGitProfileRepo($name: String!, $description: String!, $homepageUrl: URI!) {
    createRepository(input: {name: $name, visibility: PUBLIC, description: $description, homepageUrl: $homepageUrl}) {
        repository {
            ref(qualifiedName: "main") {
                repository {
                    id
                }
            }
        }
    }
}

I’m getting ref ID as null, as it is an empty repo.

Now I’m creating a commit using:

mutation ($input: CreateCommitOnBranchInput!) {
    createCommitOnBranch(input: $input) {
        commit {
            url
        }
    }
}

here expectedHeadOid is a required field, and my ref id is comming as null,

How to create a commit in this repo.
I’ve created new Repository using GitHub Graphql API.

Share

0

Reset to default



Browse other questions tagged

or ask your own question.

Leave a Reply

Your email address will not be published. Required fields are marked *