https://github.com/ethomson/actions.sh
bash helpers for GitHub Actions
https://github.com/ethomson/actions.sh
Last synced: 5 months ago
JSON representation
bash helpers for GitHub Actions
- Host: GitHub
- URL: https://github.com/ethomson/actions.sh
- Owner: ethomson
- Created: 2020-04-27T09:08:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-12T15:51:05.000Z (about 2 years ago)
- Last Synced: 2025-06-03T11:11:48.742Z (about 1 year ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bash helpers for GitHub Actions
GitHub Actions has several [workflow commands](https://help.github.com/en/actions/reference/workflow-commands-for-github-actions) that are available for use within the ecosystem. If you're building an _action_, then you can use the [GitHub Actions Toolkit](https://github.com/actions/toolkit), which will provide first class support for these commands. If you're building a workflow, then this bash library may help.
## Usage
Check this script in to your repository (you can put it in the `.github/workflows` folder, where it will be ignored). Then you can `source` this script in a `run` step of your workflow.
For example, to set a variable in a step in your workflow:
```yaml
name: Set a variable
on:
push:
branches: [ master ]
jobs:
variable:
runs-on: ubuntu-latest
steps:
- name: Set a variable
id: setter
run: |
source .github/workflows/actions.sh
set_output varname $'my\nvariable\ndata'
- name: Display a variable
run: echo ${{ steps.setter.outputs.varname }}
```
## Commands
### `set_output`
Sets a variable that can be used by subsequent steps. Carriage returns (`\r`) and newlines (`\n`) will be escaped for preservation.