Maven / GitHub Actions Interview Questions
How do you use the actions/checkout action and what does it do?
actions/checkout clones your repository onto the runner so subsequent steps have access to your source code. Without it, the runner's working directory is empty — no source files, no scripts. It is almost always the first step in any CI job.
The simplest usage just checks out the default branch at the ref that triggered the workflow:
steps:
- uses: actions/checkout@v4
Common configuration options via with::
ref:— Check out a specific branch, tag, or SHA. Useful when you need to build a release tag or compare against another branch.fetch-depth:— Number of commits to fetch. Defaults to1(shallow clone). Set to0for a full history (needed for tools likegit logor semantic-release that inspect commit history).token:— Override the defaultGITHUB_TOKENwith a PAT when you need to push commits back or access private submodules.submodules:— Set totrueor'recursive'to initialise Git submodules.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for changelog generation
submodules: recursive # also clone submodules
The action authenticates using the workflow's GITHUB_TOKEN by default, so it works without any additional secret configuration for normal repository checkouts. For pull requests from forks it checks out a merge commit (the result of merging the fork's head into the base branch) rather than the fork's raw head commit, which prevents untrusted code from poisoning the checkout.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
