Skip to content

Action Setup Bash

Actions
Our recommended setup for Bash
v1
Latest
Star (2)

release-engineers/action-setup-bash

Status: Production ready

action-setup-bash sets up ~/.bash_profile for stricter error handling and more detailed error reporting.

Usage

Refer to the example workflow;

name: Example

on:
  workflow_dispatch:

defaults:
  run:
    shell: bash --login {0}

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: release-engineers/action-setup-bash@v1
      - run: |
          echo "With the default shell set to bash --login, 'run' steps in this GitHub Workflow run ~/.bash_profile"
          echo "Any errors that occur after the setup action will be more detailed and halt the workflow"
          echo "Time to crash;"
          exit 1

Bash Profile

To see what's added to bash_profile, refer to bash_profile.sh;

#!/usr/bin/env bash

set -e -o pipefail -o errtrace -o functrace

trap_error_report() {
  lineno=$1
  command=$2
  echo "GitHub Workflow erred in bash at line $lineno on command: $command" >&2
}

trap 'trap_error_report "${LINENO}" "${BASH_COMMAND}"' ERR

Action Setup Bash is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Our recommended setup for Bash
v1
Latest

Action Setup Bash is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.