Using ready-made building blocks to supercharge your workflows
Think of prebuilt actions as ready-made building blocks or tools that other developers have created and shared for everyone to use. Instead of writing everything from scratch, you can use these proven, tested solutions.
Real-world analogy: It's like using open-source libraries in programming - instead of writing your own JSON parser or HTTP client, you use well-tested libraries that others have built. Prebuilt actions work the same way for automation tasks!
steps:
# â The hard way - doing everything manually
- name: Download my code somehow
run: |
git clone <https://github.com/myuser/myrepo.git>
cd myrepo
git checkout $GITHUB_SHA
# ... lots of complex git commands
# â
The easy way - using a prebuilt action
- name: Checkout code
uses: actions/checkout@v4 # Someone else solved this problem!
# Instead of writing 20+ lines of setup code...
- name: Install Node.js the hard way
run: |
curl -fsSL <https://deb.nodesource.com/setup_18.x> | sudo -E bash -
sudo apt-get install -y nodejs
node --version
npm --version
# Just use a prebuilt action!
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'