-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from HarborWallet/env-stuff
make sure env secrets are set
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "Test Secrets" | ||
|
||
on: | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-secrets: | ||
name: Test Secrets Access | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
|
||
- name: Make script executable | ||
run: chmod +x scripts/test-secrets.sh | ||
|
||
- name: Test Secrets | ||
env: | ||
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | ||
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} | ||
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }} | ||
run: nix develop --command bash -c "./scripts/test-secrets.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit on error | ||
|
||
# Source the environment variables if .env exists | ||
if [ -f ".env" ]; then | ||
set -a # automatically export all variables | ||
source .env | ||
set +a | ||
fi | ||
|
||
# Debug: Print shell information | ||
echo "Shell: $SHELL" | ||
echo "Bash Version: $BASH_VERSION" | ||
|
||
# Script to test access to GitHub secrets | ||
echo "Testing access to GitHub secrets..." | ||
|
||
# Check required environment variables | ||
environment=( | ||
"MACOS_CERTIFICATE" | ||
"MACOS_CERTIFICATE_PWD" | ||
"MACOS_CERTIFICATE_NAME" | ||
) | ||
|
||
for var in "${environment[@]}"; do | ||
if [[ -z "${!var}" ]]; then | ||
echo "❌ Error: $var is not set" | ||
exit 1 | ||
else | ||
echo "✅ $var is set" | ||
# Print first character of the secret if it exists (for safety) | ||
echo "$var starts with: ${!var:0:1}" | ||
fi | ||
done | ||
|
||
echo "✨ Secret test complete!" |