How to pass the GitHub Actions certification (cheat-sheet)

GitHub Actions exam Cheat Sheet -(part2)

GitHub Actions Workflows components:

  • Actions: Reusable tasks that perform specific jobs within a workflow.
  • Workflows: Automated processes in your repo that run one or more jobs, triggered by events or on a schedule.
  • Jobs: Groups of steps that execute on the same runner, typically running in parallel unless configured otherwise.
  • Steps: Individual tasks within a job that run commands or actions sequentially.
  • Runs: Instances of workflow execution triggered by events, representing the complete run-through of a workflow.
  • Runners: Servers that execute workflow jobs, either GitHub-hosted or self-hosted.
  • Marketplace: A hub for sharing reusable actions, enhancing workflow abilities with community-developed tools.

GitHub Actions Usage Limits

  • Max Job Execution Time: 6 hours
  • Max Workflow Run Time: 35 days
  • Max Job waiting for approval Time: 30 days
  • Max API Requests: 1000 requests
  • Max jobs generated by a matrix : 256 jobs (per workflow)
  • Max artifact retention: 90 days
  • Max Workflow time before deletion” More than two weeks ol
  • Max unique reusable workflows call from a single workflow file: 20Job
Total Job limits

Structure

This image has an empty alt attribute; its file name is image-1.png
Name: Workflow name 
on: Events that trigger a workflow (push on the branch git_actions for any change in paths section)
env: Variables definition (hardcoded or imported from the environment such as secrets, vars)
Permissions: To allow your actions to use the token_id
Jobs section: JobName, runner OS (runs-on) , environment, default shell and working directory
Steps section: checkout your code repo + other steps(run tests, build artifacts..)
Same for the next job…

Workflow Triggers:

Basic Event Triggers:

Trigger Type Description
push Triggers when code is pushed to a repo. Can be filtered by branches or tags.
pull_request Triggers when a pull request is opened, updated, or synchronized. Used for pull request validations and reviews.
schedule Triggers workflows on a cron basis. Used for periodic tasks.
workflow_dispatch Manually triggered from the GitHub Actions UI. Useful for on-demand tasks.
repository_dispatch You can use the GitHub API to trigger a webhook event called repository_dispatch.
workflow_call Allows the workflow to be called from another workflow. Used to create reusable workflows.
release Triggers when a new release is published. Used for release-related tasks.

Events Types:

Event Type Details
Manual Events
  • workflow_dispatch
Scheduled Events (CRON)
  • Syntax: {minute} {hour} {day} {month} {day of the week}
  • Example: cron: ‘0 14 * * 1' (2:00 PM UTC every Monday)
  • Triggers on the last commit on default branch (base branch).
  • See: events-that-trigger-workflows#schedule
Repository Dispatch Events
  • Endpoint: /repos/{owner}/{repo}/dispatches
  • Allows external API calls (<POST>) from outside GitHub.
  • Runs off the default branch.
  • Specifically designed to be triggered by webhook actions from outside the repository.

Trigger Filtering & combinations

Category Filter Comment
Branch/Tag Filters branches: [ main, develop ] (or branches-ignore) tags: [ ‘v*’ ] (or tags-ignore)
Path Filters paths: [ ‘docs/**’, ‘*.md’ ] (or paths-ignore)
Activity Types (PR) types: [ opened, synchronize ] (with pull_request)
Activity Types (Release) types: [ published, created ] (with release)
Webhooks types issues, issue_comment, create, delete

Configure workflows to run for scheduled events

Delete Vs. Disable Workflow

Disabling a Workflow Deleting a Workflow
Temporarily stop triggering Permanently remove
Easily reversible Not directly reversible (requires recreation or restore)
Use cases: Updates, maintenance, frequent triggers No longer needed, repository cleanup
cmd:gh workflow disable my_wrkf In GitHub UI
N/A
  • More than two weeks old
  • Workflow completed

Skip Workflow

You can Skip workflow runs by adding a keyword to the commit message or PR title. Use any of the following to the commit message in a push, or HEAD commit of a pull request:

[skip ci] [ci skip] [no ci] [skip actions] [actions skip]

Reusable workflows

workflow_call

Outputs from a reusable workflow or job need to be explicitly defined and passed using the correct syntax.
They are not automatically passed. Options to pass the files location (or other outputs) from a called workflow to the caller workflow are:

  • Writing the output into $GITHUB_OUTPUT
  • Defining an output at the workflow level
  • Defining an output at the job level.

Note: The GITHUB_TOKEN permissions passed from the caller workflow can be only downgraded by the called workflow.

Workflow Concurrency

By default GHA allows multiple jobs or workflow runs to run concurrently. The concurrency keyword allows you to control the concurrency of workflow runs.

Features:
  • You can use jobs.<job_id>.concurrency to ensure that only a single job or workflow using the same concurrency group will run at a time.
  • You can also specify concurrency at the workflow level.
  • A concurrency group can be any string or expression i.e github, inputs, vars, needs, strategy, and matrix.
  • Any existing pending job or workflow in the same concurrency group, will be canceled
  • Specify cancel-in-progress: true to cancel currently running job.
Example: Limit workflow runs on a branch using the concurrency keyword after trigger conditions.
### workflow Level
on:
  push:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
Concurrency groups

Manage and limit the execution of workflow runs or jobs that share the same concurrency key.

## Job level 
on:
  push:
    branches:
      - main

jobs:
  job-1:
    runs-on: ubuntu-latest
    concurrency:
      group: staging_environment
      cancel-in-progress: true
If a new run of job-1 is triggered: any runs of the same job in the staging_environment concurrency group that are already in progress will be cancelled.
In-progress job Cancelation examples:

1. Cancel any in-progress job or run in GitHub Actions

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

2.Cancel in-progress jobs/runs on pull_request events only; if github.head_ref is undefined, it will fallback to the run ID

concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true
Note: This ensures that only one workflow run for a specific pull request (branch) is active at a time.

Exclude Branch Protection Deletion

on:
  branch_protection_rule:
    types: [created, edited] # (omit deleted).

Functions in GitHub Actions:

Function Example
contains(search, item) contains('Hello world', 'llo')
startsWith(searchString, searchValue) startsWith('Hello world', 'He')
endsWith(searchString, searchValue) endsWith('Hello world', 'ld')
format(string, replaceValue0, replaceValue1, ..., replaceValueN) format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat')
join(array, optionalSeparator) join(github.event.issue.labels.*.name, ', ')
toJSON(value) toJSON(job)
fromJSON(value)
hashFiles(path) hashFiles('**/package-lock.json', '**/Gemfile.lock')

Status Check Functions:

Function Description
success() Runs if all previous steps succeeded: if: ${{ success() }}
always() Runs regardless of outcome: if: ${{ always() }}
cancelled() Runs if the workflow was canceled: if: ${{ cancelled() }}
failure() Runs if any previous step fails: if: ${{ failure() }}

GitHub actions Expression

  • contains('hello world', 'hello') → Returns true
  • startsWith('hello world', 'hello') → Returns true
  • endsWith('hello world', 'world') → Returns true
  • format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat')
  • join(github.event.issue.labels.*.name, ', ')
  • toJSON(obj), fromJSON(value)
  • hashFiles('/Gemfile.lock', '/package-lock.json')
What does the if: ${{ always() }} key-value do in a step?
  • Forces the step to run, even if a step earlier in the job has failed.

Checks API endpoint

GitHub Actions use Checks API to output statuses, results, and logs for a workflow.
GitHub uses webhooks to notify Actions of check events (i.e check_run), triggering workflows.

  • Repo/org webhooks for check_run only receive created and completed event payloads
    • Other events/activity types : rerequested | requested_action
  • When checks are set up, pull requests have a “Checks” tab for detailed build output and checks.

Caching & Artifacts

1. Artifacts:

Share outputs between jobs, retained for 90 days by default.

Set custom retention periods
    uses: actions/upload-artifact@v4
    with:
      name: my-artifact
      path: my_file.txt
      retention-days: 5    <----------------
Find the expiration date of a specific artifact
Execute a specific API call, by checking the expires_at value returned by the “Actions” API
curl -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/{owner}/{repo}/actions/artifacts/{artifact_id}
---
"expires_at": "2020-01-21T14:59:22Z"

2. Caching:

Stores dependencies to reduce workflow execution time.

  • all branches can restore caches created on the default branch
  • Purpose: improve efficiency, especially for feature branches.

GitHub Packages and Container Registry

Once published (in public or in private) you can use these images from anywhere, including:

  • In your local dev environment
  • As a base image from your GitHub Codespaces development environment
  • As a step to execute into your workflow with GitHub Actions
  • On a server or a cloud service

Features

  • Package Container url: ghcr.io
  • Example: docker pull ghcr.io/YOURNAME/publish-packages/game:TAG
  • Authentication Requirements:
    • GitHub username
    • Personal Access Token (Classic) with read:packages scope
    • GitHub Packages endpoint
  • Authenticate using a GitHub Actions workflow
    • use a GITHUB_TOKEN:
    • For package registries at PACKAGE-REGISTRY.pkg.github.com.
    • For the container registry at ghcr.io/OWNER/IMAGE-NAME.

GitHub Packages vs GitHub Releases

Packages published with GitHub inherit the visibility and permissions assigned at the repository level.

Feature GitHub Packages GitHub Releases
Purpose Publish library releases to package feeds/registries. Release software bundles with notes & binaries.
Integration Leverages package manager clients. Direct download binaries via URLs, tar/ZIP.
Tracking Links to repo & commit. Links to specific commit.

Publish GitHub Package using Workflow

1. Simple Package

Package endpoint reference
  • The endpoint will look like: https://<PACKAGE_TYPE>.pkg.github.com/OWNER/REPOSITORY
  • PACKAGE_TYPE is the type of package ecosystem you’re using.

2. Docker based package

  • Checkout: docker/login-action
  • Extract metdata docker/metadata-action
  • Setup Docker buildx (arm): docker/setup-buildx-action
  • publish docker/build-push-action
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
docker tag IMAGE_ID ghcr.io/OWNER/IMAGE_NAME:latest
docker push ghcr.io/OWNER/IMAGE_NAME:latest
Note: You can deploy package to AWS ECS | GKE | Azure App Service & AKS/Azure static Web Apps.
you must Configure deployment steps in the workflow’s YAML file.

Service Containers

SC are Docker containers that provide a simple and portable way to host services needed for testing or operating an application in a workflow.

Runners

Runners: Logical grouping of execution environments

GitHub Actions: Hosted vs Self-Hosted Runners

Feature/Aspect GitHub-Hosted Runners Self-Hosted Runners
Updates Auto OS, packages, runner app updates Manual runner app updates; manual OS/software
Management GitHub managed User managed (cloud/local)
Instance Clean per job Persistent, potentially unclean
Cost Free within limits, then per-min rates Free with Actions; user pays for infrastructure
Access Control N/A Runner groups for org/enterprise access
Customization Limited Fully configurable (hardware, OS, software, security), x64 architecture
Labels N/A User-defined labels
Proxy N/A Configurable via https_proxy, http_proxy env vars
IP Allowlists N/A Must add runner IPs to corporate allowlists
Troubleshooting N/A Check runner status, _diag folder (Runner_ & Worker_), OS-specific tools

Self-Hosted Runners

  • Must self-manage OS patching
  • Free to use with GitHub Actions
  • Shared environment for every job execution

Features:

  • Flexible: Run on various hardware (physical, virtual, cloud, etc.).
  • Levels: Can be set up at the repository, organization, or enterprise level.
  • Enterprise-level runners can be assigned to multiple organizations in an enterprise account.
  • Setup: Requires adding a runner and installing the GitHub Actions Runner software.
  • Images: Supports macOS, Linux, and Windows operating systems.
  • Architecture: Uses x64 architecture.

Restricting Actions

  • Install with: npm install @actions/core @actions/github
  • GitHub Enterprise can sync actions with: actions-sync
  • Continuous sync with GH Connect

self hosted runners labels

A self-hosted runner automatically receives certain labels when it is added to GitHub Actions.

1. Default Labels

These are used to indicate its operating system and hardware platform:

  • self-hosted: Default label applied to self-hosted runners.
  • linux, windows, or macOS: Applied depending on operating system.
  • x64, ARM, or ARM64: Applied depending on hardware architecture.
runs-on: self-hosted linux ARM64

2. Custom Labels

  • Create and assign custom labels to self-hosted runners to target specific types of runners for jobs.
  • Cumulative: Runners must have all specified labels (including OS/architecture) to be eligible for a job.
  • GPU is the custom label.
runs-on: self-hosted linux x64 gpu

Runner groups

  • Organize runners into sets and establish security boundaries.
  • Availability: For enterprise, organizations within those accounts, and organizations using GitHub Team.
  • Placement: New self-hosted runners are sent to default group and must be moved to the correct group manually.
  • Labels and Groups can be combined when routing workflows to the appropriate runner.

Configure Self-hosted Runners for Enterprise

Self-hosted runners for GitHub Enterprise have additional configuration options.

Network requirement for github connectivity

  • Permitting outbound connectivity from the runner to GitHub using long polling.
    • Self-hosted runners connect to GitHub to get jobs and download updates.
    • They use HTTPS long polling (50-second outbound connection, then reconnect).
    • ❌ Inbound to hosted runners isn’t required

Proxy Servers

IP Allowlists

A GitHub-hosted runner must establish connections to GitHub-owned endpoints to perform essential communication operations.
You must add the IP address or range of your self-hosted runners to the IP allowlist for communication to work between runners and GitHub workflows.

  • Windows and Ubuntu runners are hosted in Azure same IP address ranges as Azure datacenters.
  • MacOS runners are hosted in GitHub’s own macOS cloud.
  • The list of GitHub Actions IP addresses returned by the API is updated once a week.
  • Use larger runners with a static IP address range, or self-hosted runners.

Large Runners & IP Allowlists

  • Large runners with static IPs ranges simplify allowlist management.
  • Increased flexibility & isolation.
  • Balances security & efficiency.
IP allowlists are difficult to maintain for GitHub-hosted runners due to:
  • Large, frequently changing Azure IP ranges.
  • Increased operational burden.
  • Monitor and troubleshoot self-hosted runners

    GitHub Actions commands, contexts & Variables

    You can have repository, environment, as well as workflow, job, and step variable level.

    1. Environment variables

    2. Default Environment Variables

    Default env variables that GitHub sets are available to every step in a workflow. Example: $GITHUB_RUN_ID. most of them are similar to context variables (GITHUB_REF=github.ref)

    • Specify $ followed by the environment variable’s name.
    • Are all uppercase.
    • Most but not all have the prefix “GITHUB_”
    • Available to every step in a workflow
    • Are set by GitHub and not defined in a workflow
    • not accessible through the env context
    • GITHUB_ACTIONS
    • it always evaluates to true when GitHub Actions is running in the workflow

    Workflow Defaults

    3. Environment Files

    • Intra-job env: You can share custom env-variables with following steps in a workflow job by defining or updating the env-variable into the GITHUB_ENV environment file.
      • echo "{environment_variable_name}={value}" >> "$GITHUB_ENV"
    • Between jobs/workflows you will need GITHUB_OUTPUT

    4. Contexts

    Context is a collection of variables describing workflow runs, runner environments, jobs, steps, secrets & much more.

    • Provide a way to access information about various aspects of your workflow execution.
    • Context environment variables are prefixed with "context.variable": i.e ${{ github.sha }}

    Default Env. vs. Context Vars:

    • Default Environment vars : runner scope
    • Context vars: workflow scope.

    GitHub Actions Security (Secrets)

    • GitHubActions secrets store sensitive info passwords, API keys, tokens etc.
    • maximum secret size 48 KB
    • There are organization, repository and environment level secrets.
    • In case of conflict, organization is overridden by repository–and repo is overridden by env values.
      • Secret names are not case-sensitive, & must be unique within the same level.
      • Secret names only contain alphanum characters and '_' and can’t contain spaces
      • Secret names must not begin with the prefix GITHUB_. & must not start with numbers
    • secrets.GITHUB_TOKEN is a temporary token automatically generated for each workflow run.
    48K limit workaround: use encryption with GPG keys and storing the decryption passphrase as a secret.

    GitHub Actions Commands

    Customize runner environment

    Commands prefixed with the :: can customize the runner environment, i.e set env variables or modify the working directory

    GitHub Actions Workflow commands

    workflow commands provided by the actions/toolkit allow to send instructions to runner.

    • Can Create error annotations, set env vars, print debug messages.
    • No workflow code modification needed.

    Jobs

    Jobs have something called dependence that allows the to run in a certain order.

    Public GitHub Actions

    How to vet a public action:

    • Check if the action is in the GitHub Marketplace.
    • Check if the action is verified in the GitHub Marketplace.
    • Review the action’s action.yml file to make sure the code does what it says it does.

    Publish an action to the GitHub Marketplace

    Below requirements apply to both Docker container actions and JavaScript-based actions:

    Actions Versioning

    General Recommendations
    • Release patch versions for critical fixes and security patches, maintaining compatibility.
    • Release new major versions for changes affecting compatibility.
    • Advise users to specify a major version, directing them to specific versions only if necessary.
    • Adhere to theMAJOR.MINOR.PATCH format for
      • Clear communication of backward-incompatible changes,
      • Feature enhancements, and bug fixes.
    TAGGING Recommendations Tagging Recommendations
    • Release Branch: Test validate a release on a release/* branches.
    • Semantic Versioning: Follow major.minor.patch. (e.g., v1.0.2 or v1)
    • Major Version Tags: Update v1, v2 to point to the Git ref of the current release.
    • Breaking Changes: Introduce a new major version tag (v2) for breaking changes.
    • Introduce a new major version tag v2.0.0 on the main branch and update the action’s metadata accordingly.
    • Beta Releases: Use -beta tags (v2-beta) initially.
    • Referencing: Use major version tags (e.g., @v1) in workflows. Avoid specific versions unless necessary.
    Badges:
    You can display a status badge in your repository to indicate the status of your workflows.
    ![example workflow](https://github.com/github/docs/actions/workflows/main.yml/badge.svg)

    Show badge status of a specific event (i.e push): add ?event=push to the end of the status badge URL

    Note: In a private repo, workflow badges not accessible externally as this helps maintain the security and privacy of the repository

    Benefits of automated release process

    • Security Focus: Dependencies committed ONLY on tagged releases.
    • Secure Builds: Builds performed ONLY during release.

    Version calling

    You can include version of the action in several ways by specifying a Git ref, SHA, tag, or branch.

    Action Version reference examples
     
     # Reference a specific #SHA commit
     steps:
        - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
        
        # Reference the major version of a release
      steps:
        - uses: actions/checkout@v4                # Major version
        
        # Reference a specific version
      steps:
        - uses: actions/checkout@v4.2.0            # Specific version
        
        # Reference a branch
      steps:
        - uses: actions/checkout@main              # Branch

    If a version is not specified then the workflow will error:

    - uses: actions/checkout
    Error: .github#L1 the `uses' attribute must be a path, a Docker image, or owner/repo@ref

    GitHub Action Types

    Types of Actions Linux macOS Windows
    Docker container Yes No No
    JavaScript Yes Yes Yes
    Composite Actions Yes Yes Yes

    1. JavaScript Actions

    • Runs directly on the runner machine (Host OS)
    • Separates action code from the environment
    • Supports Windows, macOS, and Linux
    • JavaScript action runs as a single Node.js process in the runner.
    JavaScript actions vs Node.js projects (dev and distribution)
    • Bundled Dependencies: Include committing all dependent packages node_modules & code.
    • Tagged Releases Published directly to Marketplace.
    • API Integration: Requires thorough end-to-end testing.
    • Integration with various APIs
    • You can speed up development by using the GitHub Actions toolkit
    • Javascript actions can run on Linux, Windows, or macOS runners
    • Javascript actions run directly on the runner using existing binaries (don’t require additional setup or install of dependencies.)
    • the packaged JavaScript code you write should be pure JavaScript and not rely on other binaries.

    JavaScript Action Structure

    JavaScript action elements
    • /your-action-name: Root directory of your action.
    • /node_modules: Directory for project dependencies.
    • action.yml: Action’s metadata file.
    • index.js: contains Main JavaScript code.
    • package.json: Dependency and script management (npm). (exam question)
    • README.md: Documentation for your action.
    JavaScript Metadata file: action.yml
      name: 'My JavaScript Action'
      description: 'A description of your action'
      inputs:
        my-input:
          description: 'Input to use in the action'
          required: true
          default: 'default input value'
      outputs:
        my-output:
          description: 'Output from the action'
      runs:
        using: 'node12'      <------- Executor 
        main: 'index.js'    <------------- main Action code file.
    Index.js file:
    const core = require('@actions/core');
    const github = require('@actions/github');
    
    try {
      // `who-to-greet` input defined in action metadata file
      const nameToGreet = core.getInput('who-to-greet');
      console.log(`Hello ${nameToGreet}!`);
      const time = (new Date()).toTimeString();
      core.setOutput("time", time);
      // Get the JSON webhook payload for the event that triggered the workflow
      const payload = JSON.stringify(github.context.payload, undefined, 2)
      console.log(`The event payload: ${payload}`);
    } catch (error) {
      core.setFailed(error.message);
    }
    • core.setFailed(error.message); uses the actions toolkit @actions/core package to log a message and set a failing exit code.
    • Checking in your node_modules directory can cause problems. As an alternative, you can use a tool called @vercel/ncc to compile your code and modules into one file used for distribution. See Doc
    npm i -g @vercel/ncc
    ncc build index.js --license licenses.txt
    # You'll see a new dist/index.js file with your code and the compiled modules.
    Change the main keyword in your action.yml file to use the new dist/index.js file.
    main: 'dist/index.js'

    2. Docker container Actions

    • Runs your action code in a Docker container. Best suited for an Action that requires a specific Linux OS and custom tools to run.
    • Debug: for detailed information about the execution of the Docker container action, check the GitHub Actions logs.
    • Must use Linux runners and have Docker installed

    Docker Action Structure

    Docker action elements
    • /your-action-name: Root directory of your action.
    • Dockerfile: Defines the Docker image. (Case sensitive)
    • action.yml: Action’s metadata file.
    • entrypoint.sh: Shell script to execute.
    • README.md: Documentation for your action.
    Docker Metadata file: action.yml
    name: 'My Docker Action'
    description: 'A description of your action'
    inputs:
      my-input:
        description: 'Input to use in the action'
        required: true
        default: 'default input value'
    outputs:
      my-output:
        description: 'Output from the action'
    runs:
      using: 'docker'
      image: 'Dockerfile'
      entrypoint: 'entrypoint.sh'
      post: 'cleanup.sh'    <---- cleanup script after the main task has finished.
    entrypoint.sh
    #!/bin/sh
    echo "My input: $INPUT_MYINPUT"
    # ... your code here ...
    echo "::set-output name=my-output::my-output-value"

    Modifying the entrypoint.sh script to explicitly set executable permissions before running will resolve the permission denied error. `chmod +x entrypoint.sh`

    Docker Environment variables
    name: Verify Docker Action Env
    
    on: [push]
    
    jobs:
      build:
        runs-on: ubuntu-latest
    
        steps:
        - name: Checkout code
          uses: actions/checkout@v4
        - name: Run Docker Container Action and Verify Env
          uses: docker://my-dockerhub-user/my-action:latest   <-------
          env:
            MY_ACTION_VAR: "Action Special Value"
          with:
            entrypoint: /bin/bash # Override entrypoint to run a shell command
            args: -c "echo '--- Environment Variables in Action Container ---';\
             env; echo '--- End ---'"

    Manage GitHub Actions in the Enterprise

    Synchronizing GH entreprise with Github Actions

    Enterprise GitHub Actions standards

    Document the following in a GitHub wiki (README) in a repo accessible to all within an organization:
    • Repositories for storage (different workflow components)
    • Files/folders naming conventions
    • Location of shared components
    • Plans for ongoing maintenance
    • Contribution guidelines

    Policies

    To configure a GitHub Actions use policy for your enterprise. Go to your enterprise account under Policies > Actions in the sidebar.

    Enterprise GitHub Secrets

    Workflow Templates

    Is an Enterprise feature that allows to create reusable templates that other enterprises members can use.

    • Store workflow and metadata files in .github/workflow-templates
    • workflow-templates should be within a repository named .github
    • Use $default-branch placeholder for flexibility
    • Metadata file format: <WF_FILE_NAME>.properties.json
    • Users with write access to the enterprise.github repo can use them.
    • Files must have the same name (e.g., my-workflow.yml and my-workflow.json).

    Best Practice :

    Create a dedicated repository to store and manage all reusable workflows.

    1. YAML Workflow File:
      • Define workflow logic.
      • Use $default-branch placeholder.
    2. JSON Metadata File:
      • Same filename as YAML, .properties.json extension.
    3. Place both files in .github/workflow-templates in a public repo.

    Example

    Template Access & Usage:

    • Actions > New workflow > Workflows created by [org name].
    • Select from listed Workflows by clicking on > Set up this workflow

    Starter Workflow

    Starter Workflow is a pre-defined, customizable GitHub Actions workflow template provided by GitHub or organizations to help users quickly set up CI/CD automation for various languages, tools, and use cases.

    GitHub Actions UI

    When looking at workflow runs in the GitHub Actions GUI, you’ll typically find these status filters:

    Workflow Status filters
    • Success: The workflow run completed successfully.
    • Failure: The workflow run encountered an error and failed.
    • Cancelled: The workflow run was manually cancelled.
    • In progress: The workflow run is currently running.
    • Queued: The workflow run is waiting to be executed.
    • Skipped: The workflow run was skipped due to conditional logic.
    • Neutral: The workflow run had neutral results. (less common)
    • Timed out: The workflow timed out.
    • Completed: The workflow run finished, regardless of success or failure.
    What additional steps does GitHub add to each job in a workflow run?
  • "Set up job": Beginning. Info contained: runner_image, OS, GITHUB_TOKEN permissions
  • "Complete job": end cleanup.
  • Static Code Analysis

    Feature Description
    Any Checks Run on Raw Code Static analysis includes tests on code itself, not build artifacts. Includes unit tests.
    Check for Style, Version, and More Detects style/syntax issues, version conflicts, and security vulnerabilities in dependencies.
    Fail Fast Runs before time-consuming builds, quickly identifying errors.
    Feature Static Functional
    Tests Raw code Built or compiled code
    Detects Unit tests: Issues in isolation
    Linters: Syntax and formatting errors
    Deviations from expected outputs
    Resources Checks execute on runner Needs non-prod/testing environment

    🙋🏻‍♀️If you like this content please subscribe to our blog newsletter ❤️.

    👋🏻Want to chat about your challenges?
    We’d love to hear from you! 

    Share this…

    Don't miss a Bit!

    Join countless others!
    Sign up and get awesome cloud content straight to your inbox. 🚀

    Start your Cloud journey with us today .