GitHub Actions provides over 10,000 pre-built actions available through the and official GitHub repositories. Below are the most widely used official and community pre-built actions, grouped by what they do. ======================================= Core Workflow & Repository Utilities ======================================= actions/checkout: Clones your repository into the runner so subsequent steps can access your code actions/cache: Caches dependencies and build outputs (like node_modules or Maven packages) to speed up future workflow runs actions/upload-artifact & actions/download-artifact: Saves files generated during a job (such as compiled binaries, logs, or test reports) and shares them between jobs or makes them downloadable after the run. actions/github-script. Lets you write inline JavaScript to interact directly with the GitHub API and workflow context. ======================================= Language & Runtime Setup ======================================= actions/setup-node: Installs a specific version of Node.js and configures package caching (npm, yarn, pnpm) actions/setup-python: Installs a specified Python version and sets up pip caching actions/setup-java: Configures a Java Development Kit (JDK) distribution (e.g. Temurin, Corretto) and caches Maven/Gradle dependencies actions/setup-go: Installs a specific Go toolchain version and manages module caching. ======================================= Docker & Containerization ======================================= docker/setup-buildx-action: Initializes Docker Buildx to enable multi-platform builds and advanced caching docker/login-action: Authenticates the runner with a container registry like Docker Hub, GitHub Container Registry (ghcr.io), or AWS ECR docker/build-push-action. Builds a Docker image from a Dockerfile and pushes it to a configured registry. ======================================= Cloud & Deployment ======================================= aws-actions/configure-aws-credentials: Authenticates the workflow with AWS using OIDC (recommended) or access keys azure/login: Connects the runner to Microsoft Azure using service principals or OIDC google-github-actions/auth: Authenticates with Google Cloud Platform (GCP) via Workload Identity Federation or service account keys actions/deploy-pages: Deploys static site build artifacts directly to GitHub Pages. ======================================= Security & Code Quality ======================================= github/codeql-action: Runs CodeQL static analysis to detect security vulnerabilities and coding errors in your repository actions/dependency-review-action. Scans pull requests for newly introduced dependencies with known security vulnerabilities or incompatible licenses trufflesecurity/trufflehog: Scans commits and code diffs for accidentally committed API keys, passwords, and secrets. --------------------------------------- How to Use Them in a Workflow You call any pre-built action inside a job's steps block using the uses keyword with the {owner}/{repo}@{version} syntax: steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' ======================================= Common Built-in Contexts & Expressions ======================================= While not commands, these pre-built variables are used everywhere in YAML files: • ${{ github.sha }} — The exact commit hash that triggered the workflow • ${{ github.ref_name }} — The branch or tag name (e.g. main) • ${{ secrets.MY_SECRET }} — Encrypted secrets stored in repository settings • ${{ vars.MY_VAR }} — Non-sensitive configuration variables • ${{ runner.os }} — Operating system of the runner (Linux, Windows, or macOS). ******************************************************************************* The "needs" keyword in GitHub Actions YAML creates dependencies between jobs, ensuring a job runs sequentially after its required upstream jobs succeed rather than executing in parallel. 1. Basic Syntax By default, all jobs inside a GitHub Actions workflow run in parallel. Adding needs: forces a job to wait until the specified job(s) complete successfully. yaml jobs: # Job 1: Runs immediately lint-and-test: runs-on: ubuntu-latest steps: - run: echo "Running Ruff, Mypy, and Pytest..." # Job 2: Waits for 'lint-and-test' to succeed sonarqube-scan: needs: lint-and-test runs-on: ubuntu-latest steps: - run: echo "Running SonarQube analysis..." # Job 3: Waits for BOTH Job 1 and Job 2 to succeed deploy: needs: [lint-and-test, sonarqube-scan] runs-on: ubuntu-latest steps: - run: echo "Deploying to production..." ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2. Passing Data Between Jobs with needs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can access outputs generated by an upstream job using the ${{ needs..outputs. }} context: yaml jobs: build: runs-on: ubuntu-latest # Expose step outputs at the job level outputs: version: ${{ steps.get_ver.outputs.ver }} steps: - id: get_ver run: echo "ver=1.2.0" >> "$GITHUB_OUTPUT" deploy: needs: build runs-on: ubuntu-latest steps: # Read the output from the 'build' job - run: echo "Deploying version ${{ needs.build.outputs.version }}" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3. Behavior & Conditional Overrides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Default Failure Behaviour: If any job listed in needs: fails or is skipped, the dependent job is automatically skipped. Run Even If Upstream Fails: Combine needs: with if: always() (or if: failure()) to force a job—such as a clean-up step or failure notification—to run regardless of the upstream result: yaml jobs: test: runs-on: ubuntu-latest steps: - run: pytest notify-on-failure: needs: test if: failure() # Runs only if 'test' failed runs-on: ubuntu-latest steps: - run: echo "Sending Slack alert..."