Using Script Commands
This document introduces how to execute shell commands, call scripts in the repository, set environment variables, write output parameters, and mask sensitive information through run in steps.
When you need to execute shell commands, call scripts in the repository, set environment variables, or write output parameters in a step.
Prerequisites
runs-onhas been configured and you are familiar with the pre-installed tools on the Runner.- If executing scripts in the repository, you need to checkout the code first.
Quick Example
jobs:
build:
name: Build
runs-on: [ubuntu-latest, x64, small]
steps:
- name: Checkout source code
uses: checkout
- name: Run build script
run: bash ./scripts/build.sh
Configuration Description
Execute Scripts in the Repository
Execute existing script files in the repository:
steps:
- name: Checkout source code
uses: checkout
- name: Run build script
run: bash ./scripts/build.sh
Note: The script file may not have execution permissions. It is recommended to use
bash script.shor firstchmod +x script.sh.
Set Execution Permissions
steps:
- name: Checkout source code
uses: checkout
- name: Run bash
run: chmod +x ./scripts/build.sh
- name: Run build
run: ./scripts/build.sh
Write Step Output
Use the ATOMGIT_OUTPUT environment variable to write step output parameters:
steps:
- name: Run output
id: version
run: echo "version=1.0.0" >> "$ATOMGIT_OUTPUT"
- name: Use output
run: echo "${{ steps.version.outputs.version }}"