Skip to content

Commit b3ab95c

Browse files
author
LE SAULNIER Kevin
committed
fix: check inputs step
Signed-off-by: LE SAULNIER Kevin <[email protected]>
1 parent 9faad44 commit b3ab95c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/prepare-release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,36 @@ jobs:
2626
with:
2727
submodules: false
2828

29+
- name: Validate inputs
30+
run: |
31+
if ! date -d "${{ github.event.inputs.target_date }}" "+%Y-%m-%dT%H:%M:%SZ" >/dev/null 2>&1; then
32+
echo "❌ Invalid date"
33+
exit 1
34+
fi
35+
echo "✅ Valid date"
36+
37+
if [[ "github.event.inputs.release-version" =~ ^[0-9]+\.[0-9]+$ ]]; then
38+
echo "✅ Valid version"
39+
else
40+
echo "❌ Invalid version"
41+
fi
42+
43+
REPOS_TO_RELEASE_INPUT="${{ github.event.inputs.repos_to_release }}"
44+
CONFIG_FILE=".github/config/repos-to-release.txt"
45+
46+
# Convert multi-line input to table
47+
IFS=$'\n' read -d '' -r -a urls <<< "$REPOS_TO_RELEASE_INPUT"
48+
49+
# Check earch url is contained in config file
50+
for url in "${urls[@]}"; do
51+
if ! grep -Fxq "$url" "$CONFIG_FILE"; then
52+
echo "❌ URL '$url' is unauthorized"
53+
exit 1
54+
fi
55+
done
56+
57+
echo "✅ All URLs are valid"
58+
2959
- uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1 v1.11.6
3060
id: app-token
3161
name: Generate app token

0 commit comments

Comments
 (0)