actions / actions/checkout

Feature Proposal: Submodules on the same branch

Open
#401 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.9k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

Due to our needs, I have implemented on our fork a feature which may be useful to some users. If there is some interest, I'll submit a PR here (after a bit of cleanup). Please see https://github.com/sasfermat/checkout/tree/fermat-submodules-branch.

The use case is quite common for the development workflows I have been using. Here is a description:

We have a parent repository and submodules. Quite often, changes happen in more than one submodule at once, in order to implement an overall API change for instance. When this happens, in order to be able to checkout all the changes to test at once, we decided to name all the branches on all the impacted submodules with the same name so that they are identifiable and implemented a way to tell the checkout action to checkout each submodule on a branch if it exists.

Implemented solution:
I have added an input called 'submodules-remote-branch' and the code checks on each submodule whether a branch with that name exists. In case it exists, the submodule is checked out of that branch.
In our pull request workflows, I set this input param to ${{ github.head_ref}} which leaves it empty for non PR.

I understand this may be a bit too specific for a generic action like 'checkout' but I'd rather propose it in case other people are interested.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the proposed implementation at https://github.com/sasfermat/checkout/tree/fermat-submodules-branch and trace the checkout action's submodule handling. Focus on the submodules-remote-branch input and its behavior when a matching branch exists or does not exist. Done means the action can apply the branch consistently across submodules without changing the existing behavior for non-PR workflows.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.