DEV Community

Kishan B
Kishan B

Posted on • Edited on • Originally published at kishaningithub.github.io

Checking out code using github action in legacy runner

Problem

Performing a simple git checkout using official checkout action fails in a legacy self hosted runner running amazon linux 2 because newer versions of nodejs(>= 20) requires a newer version of GLIBC which is not available in these operating systems.

Solution

Use bash to perform the checkout in the action code i.e

replace the line

- uses: actions/checkout@v3
Enter fullscreen mode Exit fullscreen mode

with

- name: Checkout
  run: |
    git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
Enter fullscreen mode Exit fullscreen mode

Note

  • --depth 1 performs a shallow-clone there by increasing your performance as we don't need to pull the entire commit history for every pipeline run.
  • ${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} doing this to ensure we always get the name of the branch which triggered the pipelines. This way of doing it makes it trigger agnostic i.e. both push and pull request trigger will work as intended.
  • . The dot at the end ensures that the checkout happens in the current directory which is the workspace.

Quickstart image

Django MongoDB Backend Quickstart! A Step-by-Step Tutorial

Get up and running with the new Django MongoDB Backend Python library! This tutorial covers creating a Django application, connecting it to MongoDB Atlas, performing CRUD operations, and configuring the Django admin for MongoDB.

Watch full video →

Top comments (0)

👋 Kindness is contagious

Value this insightful article and join the thriving DEV Community. Developers of every skill level are encouraged to contribute and expand our collective knowledge.

A simple “thank you” can uplift someone’s spirits. Leave your appreciation in the comments!

On DEV, exchanging expertise lightens our path and reinforces our bonds. Enjoyed the read? A quick note of thanks to the author means a lot.

Okay