Skip to content

Commit

Permalink
Expose GITHUB_ACTIONS env var to docker containers (#3123)
Browse files Browse the repository at this point in the history
### Motivation:

It can be useful for scripts to be able to check if they are being run
in CI. Because we invoke docker on the CI runners, the env var which
people may use to do this isn't present.

### Modifications:

Expose `GITHUB_ACTIONS` env var to docker containers in the matrix
workflow

### Result:

Adopters of the matrix workflow or downstream workflows will be able to
check if they are running in CI
  • Loading branch information
rnro authored Feb 26, 2025
1 parent 4c14ce5 commit ad3cbec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/swift_test_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
workspace="/$(basename ${{ github.workspace }})"
docker run -v ${{ github.workspace }}:"$workspace" \
-w "$workspace" \
-e GITHUB_ACTIONS="$GITHUB_ACTIONS" \
-e SWIFT_VERSION="${{ matrix.config.swift_version }}" \
-e setup_command_expression="$setup_command_expression" \
-e workspace="$workspace" \
Expand All @@ -59,6 +60,7 @@ jobs:
$workspace = "C:\" + (Split-Path ${{ github.workspace }} -Leaf)
docker run -v ${{ github.workspace }}:$($workspace) `
-w $($workspace) `
-e GITHUB_ACTIONS=%GITHUB_ACTIONS% `
-e SWIFT_VERSION="${{ matrix.config.swift_version }}" `
-e setup_command_expression=%setup_command_expression% `
${{ matrix.config.image }} `
Expand Down

0 comments on commit ad3cbec

Please sign in to comment.