git clone without actions/checkout
Your workflow should be lightweight as you wanted.
Intro
Did you know? When you do actions/checkout in your workflow:
name: My workflow
on:
push:
branches:
- main
jobs:
deploy:
runs-on: codeberg-tiny
steps:
- name: Checkout my repository
uses: actions/checkout@v6
You are running a bunch of Node.js code, just for cloning the repo.
How’s that?
If you think it’s fine, then all ok;
if you think it’s ridiculous, just take this:
steps:
- name: Clone my repository
run: |
git clone "https://oauth2:${GITHUB_TOKEN}@${GITHUB_SERVER_URL#*//}/${GITHUB_REPOSITORY}.git" .
It even works for private repositories!
To do more like checking-out specified branch, just add corresponding git commands.
More hacks
There are more useful environment variables in Actions environment. You can use a test workflow:
steps:
- name: Show env
run: env
And see all environment variables in workflow output.