-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b968d2d
commit 7d1f7c7
Showing
1 changed file
with
35 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,45 @@ on: | |
workflow_call: | ||
push: | ||
branches: | ||
- "**" | ||
pull_request: | ||
branches: | ||
- "**" | ||
- '**' | ||
|
||
jobs: | ||
detect-secret-leaks: | ||
runs-on: ubuntu-latest | ||
runs-on: gh-runner | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Authenticate with Vault using GitHub OIDC | ||
id: vault_auth | ||
uses: hashicorp/[email protected] | ||
with: | ||
url: http://vault.vault.svc.cluster.local:8200 | ||
caCertificate: ${{ secrets.VAULT_CA_CERT }} | ||
method: github | ||
githubToken: ${{ secrets.VAULT_TOKEN }} | ||
|
||
# https://github.com/hashicorp/vault-action?tab=readme-ov-file#multiple-secrets | ||
- name: Retrieve secrets from Vault | ||
id: get_secrets | ||
uses: hashicorp/[email protected] | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
method: jwt | ||
role: github-actions | ||
secrets: | | ||
secret/kv/fertiscan/frontend * | API_KEY_ ; | ||
secret/kv/fertiscan/frontend * | API_KEY_ ; | ||
secret/kv/fertiscan/database * | API_KEY_ ; | ||
secret/kv/fertiscan-dev * | API_KEY_ ; | ||
secret/kv/nachet * | API_KEY_ ; | ||
secret/kv/finesse * | API_KEY_ | ||
env: | ||
VAULT_TOKEN: ${{ steps.vault_auth.outputs.vault_token }} | ||
|
||
- name: Install git-secrets | ||
run: | | ||
sudo apt-get update | ||
|
@@ -30,14 +57,10 @@ jobs: | |
git secrets --install | ||
- name: Add API keys to git-secrets | ||
env: | ||
API_KEYS: ${{ secrets.AI_CFIA_API_KEYS }} | ||
run: | | ||
echo "$API_KEYS" > api_keys.txt | ||
while IFS= read -r api_key; do | ||
git secrets --add --literal "$api_key" | ||
done < api_keys.txt | ||
rm -f api_keys.txt | ||
for var in $(compgen -e API_KEY_); do | ||
git secrets --add --literal "${!var}" | ||
done | ||
- name: Scan repository for secrets | ||
run: | | ||
|