Skip to content

Commit 9f7ff36

Browse files
committed
Check variable input before adding to GITHUB_ENV
This ensures `.nightly-version` is well defined, along with `brew --prefix` (our only other instance of variable environment variables).
1 parent 1d5444e commit 9f7ff36

6 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/actions/build-dependencies/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ runs:
4646
elif [ "$RUNNER_OS" == "macOS" ]; then
4747
brew install protobuf llvm
4848
HOMEBREW_PREFIX=$(brew --prefix)
49+
[ -d "$HOMEBREW_PREFIX" ]
4950
ls $HOMEBREW_PREFIX/opt/llvm/lib | grep "libclang.dylib" # Make sure this installed `libclang`
5051
echo "DYLD_LIBRARY_PATH=$HOMEBREW_PREFIX/opt/llvm/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV"
5152
fi

.github/nightly-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2026-04-01
1+
2026-04-01

.github/workflows/lint.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ jobs:
2525
- name: Get nightly version to use
2626
id: nightly
2727
shell: bash
28-
run: echo "NIGHTLY_VERSION=$(cat .github/nightly-version)" >> "$GITHUB_ENV"
28+
run: |
29+
# Ensure `nightly-version` only contains numbers and dashes
30+
[ $(grep -v "^[0-9-]*$" .github/nightly-version | wc -l || true) -eq 0 ]
31+
echo "NIGHTLY_VERSION=nightly-$(cat .github/nightly-version)" >> "$GITHUB_ENV"
2932
3033
- name: Build Dependencies
3134
uses: ./.github/actions/build-dependencies
@@ -93,7 +96,10 @@ jobs:
9396
- name: Get nightly version to use
9497
id: nightly
9598
shell: bash
96-
run: echo "NIGHTLY_VERSION=$(cat .github/nightly-version)" >> "$GITHUB_ENV"
99+
run: |
100+
# Ensure `nightly-version` only contains numbers and dashes
101+
[ $(grep -v "^[0-9-]*$" .github/nightly-version | wc -l || true) -eq 0 ]
102+
echo "NIGHTLY_VERSION=nightly-$(cat .github/nightly-version)" >> "$GITHUB_ENV"
97103
98104
- name: Build Dependencies
99105
uses: ./.github/actions/build-dependencies
@@ -135,7 +141,10 @@ jobs:
135141
- name: Get nightly version to use
136142
id: nightly
137143
shell: bash
138-
run: echo "NIGHTLY_VERSION=$(cat .github/nightly-version)" >> "$GITHUB_ENV"
144+
run: |
145+
# Ensure `nightly-version` only contains numbers and dashes
146+
[ $(grep -v "^[0-9-]*$" .github/nightly-version | wc -l || true) -eq 0 ]
147+
echo "NIGHTLY_VERSION=nightly-$(cat .github/nightly-version)" >> "$GITHUB_ENV"
139148
140149
- name: Install nightly rust
141150
shell: bash

.github/workflows/monthly-nightly-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Write nightly version
2020
shell: bash
21-
run: echo $(date +"nightly-%Y-%m"-01) > .github/nightly-version
21+
run: echo $(date +"%Y-%m"-01) > .github/nightly-version
2222

2323
- name: Create the commit
2424
shell: bash

.github/workflows/no-std.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ jobs:
4040
- name: Get nightly version to use
4141
id: nightly
4242
shell: bash
43-
run: echo "NIGHTLY_VERSION=$(cat .github/nightly-version)" >> "$GITHUB_ENV"
43+
run: |
44+
# Ensure `nightly-version` only contains numbers and dashes
45+
[ $(grep -v "^[0-9-]*$" .github/nightly-version | wc -l || true) -eq 0 ]
46+
echo "NIGHTLY_VERSION=nightly-$(cat .github/nightly-version)" >> "$GITHUB_ENV"
4447
4548
- name: Install RISC-V Toolchain
4649
shell: bash

.github/workflows/pages.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
bundler-cache: true
5858
cache-version: 0
5959
working-directory: "${{ github.workspace }}/docs"
60+
6061
- name: Setup Pages
6162
id: pages
6263
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # 5.0.0
@@ -70,9 +71,14 @@ jobs:
7071
- name: Get nightly version to use
7172
id: nightly
7273
shell: bash
73-
run: echo "NIGHTLY_VERSION=$(cat .github/nightly-version)" >> "$GITHUB_ENV"
74+
run: |
75+
# Ensure `nightly-version` only contains numbers and dashes
76+
[ $(grep -v "^[0-9-]*$" .github/nightly-version | wc -l || true) -eq 0 ]
77+
echo "NIGHTLY_VERSION=nightly-$(cat .github/nightly-version)" >> "$GITHUB_ENV"
78+
7479
- name: Build Dependencies
7580
uses: ./.github/actions/build-dependencies
81+
7682
- name: Buld Rust docs
7783
shell: bash
7884
run: |

0 commit comments

Comments
 (0)