Skip to content
Discussion options

You must be logged in to vote

Short answer: there is no single “update submodule” API in Octokit.js. A submodule update is just a commit that changes the submodule gitlink SHA, and you have to do that manually via the Git data APIs.

How it works conceptually

A submodule is stored in the parent repo as a special tree entry that points to a commit SHA in another repo. Updating it means creating a new commit in the parent repo with a new gitlink SHA.

The correct way using Octokit.js

You must:

Get the latest commit SHA of the submodule repo

Create a new tree in the parent repo that updates the submodule entry

Create a commit with that tree

Update the branch reference

Minimal example (Octokit.js)
import { Octokit } from "@…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by zegof
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apps API and Webhooks Discussions related to GitHub's APIs or Webhooks Question Ask and answer questions about GitHub features and usage
3 participants