├── .github └── workflows │ └── test.yml └── README.md /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - name: Run a multi-line script 18 | shell: 'script -q -e -c "bash {0}"' 19 | run: | 20 | perl -E 'say "Is STDOUT a TTY?: ", -t STDOUT ? "yes" : "no"' 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hack to create TTY for GitHub Actions runners 2 | 3 | As of December 2020, GitHub Actions do not create TTY for their runnders, as the following issue has reported: 4 | 5 | https://github.com/actions/runner/issues/241 6 | 7 | For a wokaround in Linux, `script(1)` can solve this problem like this: 8 | 9 | ```yaml 10 | # ... 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Run a multi-line script 20 | shell: 'script -q -e -c "bash {0}"' 21 | run: | 22 | perl -E 'say "Is STDOUT a TTY?: ", -t STDOUT ? "yes" : "no"' 23 | ``` 24 | 25 | where `shell: 'script -q -e -c "bash {0}"'` is the trick. 26 | --------------------------------------------------------------------------------