actions / actions/toolkit

Bash Aliases don't seem to be getting executed with Github actions

Open
#766 3 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Bash Aliases seem to be getting exported correctly in a Github action workflow but when you execute them Gh Actions fails. This post - https://github.community/t/create-and-use-an-alias-inside-github-action/147616 - has all the details that you'd need. I also tried to shopt -s expand_aliases before using the alias as commented on the post, it still fails. As mentioned in the post, when you list all the aliases using alias in the workflow it would list it correctly (so that'd mean it was correctly set on ubuntu bash in github actions). But what's weird and strange is when trying to use that alias to execute something it'd fail. What's worse is that the workflow seems to fail with a non-intuitive error message as well. Can support be extended to use bash aliases in Github actions? I think other CI systems, like Travis CI support for it.

This is a sample of my workflow definition where it's failing (see the alias step below - at which stork line where it fails). Stork executable is part of my repo and I've validated it locally that it can be executed correctly, so that alias should have also worked correctly, in ideal case.:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Setup python
        uses: actions/setup-python@v2
        with:
          python-version: 3.8

      - name: Setup Stork Alias
        run: |
          shopt -s expand_aliases
          alias stork="./stork"
          echo "List the aliases"
          alias
          shopt -s expand_aliases
          which stork

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided ubuntu-latest workflow, including the alias definition, alias listing, and which stork step. Then inspect the GitHub Actions shell behavior and determine whether the toolkit exposes a relevant entry point; done should mean the alias behavior and resulting error are explicitly addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, github-actions
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.