{"id":14985928,"url":"https://github.com/sgoudham/update-git-submodules","last_synced_at":"2025-10-24T18:17:04.279Z","repository":{"id":253722168,"uuid":"843980396","full_name":"sgoudham/update-git-submodules","owner":"sgoudham","description":"GitHub Action to update git submodule(s) to their latest commit or tag","archived":false,"fork":false,"pushed_at":"2025-04-10T23:08:26.000Z","size":947,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T22:11:52.166Z","etag":null,"topics":["action","git","git-submodules"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgoudham.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-18T02:28:59.000Z","updated_at":"2025-04-10T23:08:29.000Z","dependencies_parsed_at":"2024-10-18T11:21:52.907Z","dependency_job_id":"53a035f9-4afb-4e82-9ee1-f3c40fe23786","html_url":"https://github.com/sgoudham/update-git-submodules","commit_stats":{"total_commits":41,"total_committers":4,"mean_commits":10.25,"dds":"0.46341463414634143","last_synced_commit":"463aade2e6a94ec695833c99117c0ab807aaf64a"},"previous_names":["sgoudham/update-git-submodules"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Fupdate-git-submodules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Fupdate-git-submodules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Fupdate-git-submodules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgoudham%2Fupdate-git-submodules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgoudham","download_url":"https://codeload.github.com/sgoudham/update-git-submodules/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487690,"owners_count":21112190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","git","git-submodules"],"created_at":"2024-09-24T14:11:57.940Z","updated_at":"2025-10-24T18:17:04.270Z","avatar_url":"https://github.com/sgoudham.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    update-git-submodules \n    \u003cbr\u003e\n    ( \u003ca href=\"https://github.com/sgoudham/update-git-submodules/actions/workflows/build.yml\"\u003e\u003cimg src=\"https://github.com/sgoudham/update-git-submodules/actions/workflows/build.yml/badge.svg\"\u003e\u003c/a\u003e )\n\u003c/h1\u003e\n\nThis GitHub Action updates one or more git submodules in a repository to the\nlatest commit or tag. The primary motivation behind creating this action was for\nit be used across [Catppuccin](https://github.com/catppuccin), allowing\nrepositories to update their submodules to the latest git tag instead of the\nlatest commit.\n\n\u003e [!NOTE]  \n\u003e This action assumes that all git submodules are located in a separate GitHub\n\u003e repository, please raise an\n\u003e [issue](https://github.com/sgoudham/update-git-submodules/issues/new) if you'd\n\u003e like to see other platforms supported.\n\n### What it does\n\n- It automatically parses the `.gitmodules` file to find submodules.\n- It updates one or more submodules to the latest commit or git tag.\n- It allows the user to filter which submodules to update.\n\n### What it doesn't do\n\n- It **does not** commit or push these changes back to the repository. Please\n  see the \"[Creating Pull Requests](#creating-pull-requests)\" section for examples on how to do this.\n\n## Usage\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```yaml\n- uses: sgoudham/update-git-submodules@v2.1.3\n  with:\n    # The path to the '.gitmodules' file.\n    #\n    # Defaults to '.gitmodules' in the root of the repository.\n    gitmodulesPath: \"\"\n\n    # The strategy to use when updating the submodules. Can be either 'commit' or 'tag'.\n    #\n    # Defaults to 'commit'.\n    strategy: \"\"\n\n    # The git submodule(s) to update, the path should be the\n    # same as the one specified in the '.gitmodules' file.\n    #\n    # Defaults to all submodules in the '.gitmodules' file.\n    submodules: \"\"\n```\n\n## Outputs\n\n### Static Outputs\n\n- `json`: A JSON array containing all the submodules that were updated.\n- `matrix`: A JSON array containing all the submodules that were updated,\n  intended for use in a GitHub Actions matrix strategy.\n- `prBody`: A multi-line Markdown string containing a formatted table of all the submodules\n  that were updated, intended for use in a pull request body.\n\n### Dynamic Outputs\n\nAs well as the static outputs, this action will also output the following\nvariables for each submodule that was updated:\n\n- `${prefix}--updated`: Always set to `true` to indicate that the submodule was updated.\n- `${prefix}--path`: The path to the submodule that was updated.\n- `${prefix}--url`: The GitHub URL of the submodule that was updated.\n- `${prefix}--remoteName`: The name of the remote repository of the submodule\n  that was updated. (e.g. `sgoudham/update-git-submodules`)\n- `${prefix}--previousShortCommitSha`: The short commit SHA of the submodule\n  before it was updated.\n- `${prefix}--previousCommitSha`: The commit SHA of the submodule before it\n  was updated.\n- `${prefix}--latestShortCommitSha`: The short commit SHA of the submodule\n  after it was updated.\n- `${prefix}--latestCommitSha`: The commit SHA of the submodule after it was\n  updated.\n- `${prefix}--previousTag`: The latest tag of the submodule before it was updated. **May not exist if the submodule does not have any tags.**\n- `${prefix}--latestTag`: The tag that the submodule was updated to. **Only available when the strategy is set to 'tag'.**\n- `${prefix}--prBody`: A multi-line Markdown string intended for use in a pull request body.\n\nThe `${prefix}` is the submodule name or the submodule path if the name is\ndifferent to the path. For example, if the submodule is named `vscode-icons` and\nthe path is `ports/vscode-icons`, the dynamic outputs will be:\n\n- `vscode-icons--updated`\n- `vscode-icons--path`\n- `vscode-icons--url`\n- `vscode-icons--remoteName`\n- `vscode-icons--previousShortCommitSha`\n- `vscode-icons--previousCommitSha`\n- `vscode-icons--latestShortCommitSha`\n- `vscode-icons--latestCommitSha`\n- `vscode-icons--previousTag`\n- `vscode-icons--latestTag`\n- `vscode-icons--prBody`\n- `ports/vscode-icons--updated`\n- `ports/vscode-icons--path`\n- `ports/vscode-icons--url`\n- `ports/vscode-icons--remoteName`\n- `ports/vscode-icons--previousShortCommitSha`\n- `ports/vscode-icons--previousCommitSha`\n- `ports/vscode-icons--latestShortCommitSha`\n- `ports/vscode-icons--latestCommitSha`\n- `ports/vscode-icons--previousTag`\n- `ports/vscode-icons--latestTag`\n- `ports/vscode-icons--prBody`\n\n## Examples\n\n### Update all submodules to the latest commit\n\n```yaml\n- name: Update Submodules\n  id: submodules\n  uses: sgoudham/update-git-submodules@v2.1.3\n```\n\n### Update all submodules to the latest tag\n\n```yaml\n- name: Update Submodules\n  id: submodules\n  uses: sgoudham/update-git-submodules@v2.1.3\n  with:\n    strategy: tag\n```\n\n### Update single submodule\n\n```yaml\n- name: Update Submodule\n  id: submodules\n  uses: sgoudham/update-git-submodules@v2.1.3\n  with:\n    submodules: ports/vscode-icons\n```\n\n### Update multiple submodules\n\n```yaml\n- name: Update Submodules\n  id: submodules\n  uses: sgoudham/update-git-submodules@v2.1.3\n  with:\n    submodules: |\n      ports/nvim\n      ports/mdBook\n      ports/vscode-icons\n```\n\n## Creating Pull Requests\n\n### Update single submodule and create pull request\n\n```yaml\nsteps:\n  - name: Checkout Repository\n    uses: actions/checkout@v4\n    with:\n      submodules: \"recursive\"\n      fetch-depth: 0\n\n  - name: Update Submodules\n    id: submodules\n    uses: sgoudham/update-git-submodules@v2.1.3\n\n  - name: Create PR\n    uses: peter-evans/create-pull-request@v6\n    if: ${{ steps.submodules.outputs['vscode-icons--updated'] }}\n    with:\n      commit-message: \"feat: update catppuccin/vscode-icons to ${{ steps.submodules.outputs['vscode-icons--latestShortCommitSha'] }}\"\n      branch: \"feat/update-vscode-icons-${{ steps.submodules.outputs['vscode-icons--latestShortCommitSha'] }}\"\n      title: \"feat: update catppuccin/vscode-icons submodule to ${{ steps.submodules.outputs['vscode-icons--latestShortCommitSha'] }}\"\n      body: ${{ steps.submodules.outputs.prBody }}\n```\n\n### Update multiple submodules and create one pull request\n\n```yaml\nsteps:\n  - name: Checkout Repository\n    uses: actions/checkout@v4\n    with:\n      submodules: \"recursive\"\n      fetch-depth: 0\n\n  - name: Update Submodules\n    id: submodules\n    uses: sgoudham/update-git-submodules@v2.1.3\n\n  - name: Create PR\n    uses: peter-evans/create-pull-request@v6\n    with:\n      commit-message: \"feat: update all submodules\"\n      branch: \"feat/update-all-submodules\"\n      title: \"feat: update all submodules\"\n      body: ${{ steps.submodules.outputs.prBody }}\n```\n\n### Update multiple submodules and create multiple pull requests\n\n```yaml\njobs:\n  update-submodule:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        submodule: [ports/nvim, ports/mdBook, ports/vscode-icons]\n        include:\n          - submodule: ports/nvim # Update to the latest tag\n            strategy: \"tag\"\n            latest: \"latestTag\"\n          - submodule: ports/mdBook # Update to the latest commit\n            strategy: \"commit\"\n            latest: \"latestShortCommitSha\"\n          - submodule: ports/vscode-icons # Update to the latest commit\n            strategy: \"commit\"\n            latest: \"latestShortCommitSha\"\n    steps:\n      - name: Checkout Repository\n        uses: actions/checkout@v4\n        with:\n          submodules: \"recursive\"\n          fetch-depth: 0\n\n      - name: Update Submodules\n        id: submodules\n        uses: sgoudham/update-git-submodules@v2.1.3\n        with:\n          submodules: ${{ matrix.submodule }}\n          strategy: ${{ matrix.strategy }}\n\n      - name: Create PR\n        uses: peter-evans/create-pull-request@v6\n        if: ${{ steps.submodules.outputs[format('{0}--updated', matrix.submodule)] }}\n        with:\n          commit-message: \"feat: update ${{ matrix.submodule }} to ${{ steps.submodules.outputs[format('{0}--{1}', matrix.submodule, matrix.latest)] }}\"\n          branch: \"feat/update-${{ matrix.submodule }}-${{ steps.submodules.outputs[format('{0}--{1}', matrix.submodule, matrix.latest)] }}\"\n          title: \"feat: update ${{ matrix.submodule }} submodule to ${{ steps.submodules.outputs[format('{0}--{1}', matrix.submodule, matrix.latest)] }}\"\n          body: ${{ steps.submodules.outputs.prBody }}\n```\n\n\u003c!-- x-release-please-end --\u003e\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgoudham%2Fupdate-git-submodules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgoudham%2Fupdate-git-submodules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgoudham%2Fupdate-git-submodules/lists"}