Skip to content

Commit 9b3b0d2

Browse files
committed
test: add premission block
1 parent 74c2d23 commit 9b3b0d2

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/workflows/testinfra-only.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
name: Testinfra Test Only
2+
3+
permissions:
4+
contents: read
5+
id-token: write
6+
27
on:
38
workflow_dispatch:
49
inputs:
@@ -17,11 +22,6 @@ jobs:
1722
runs-on: ubuntu-latest
1823
steps:
1924
- uses: actions/checkout@v4
20-
- name: Configure AWS credentials
21-
uses: aws-actions/configure-aws-credentials@v4
22-
with:
23-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-role
24-
aws-region: ${{ env.AWS_REGION }}
2525
- name: Run tests
2626
timeout-minutes: 10
2727
env:

flake.nix

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,13 @@
870870
# Get current repository name
871871
REPO=$(git remote get-url origin | sed -E 's/.*github.com[:/](.*)\.git/\1/')
872872
873+
# Check AWS credentials
874+
if [ -z "${AWS_VAULT:-}" ]; then
875+
echo "Error: AWS_VAULT environment variable must be set with the profile name"
876+
echo "Usage: aws-vault exec supabase-dev -- nix run .#run-testinfra <ami-name> [branch]"
877+
exit 1
878+
fi
879+
873880
# Trigger the workflow with the AMI name
874881
echo "Triggering testinfra-only workflow for AMI: $AMI_NAME on branch: $BRANCH"
875882
gh workflow run testinfra-only.yml --ref "$BRANCH" -f ami_name="$AMI_NAME"
@@ -879,7 +886,7 @@
879886
sleep 5
880887
881888
# Get the latest run ID for this workflow
882-
RUN_ID=$(gh run list --workflow=testinfra-only.yml --branch "$BRANCH" --limit 1 --json databaseId --jq '.[0].databaseId')
889+
RUN_ID=$(gh run list --workflow=testinfra-only.yml --branch "$BRANCH" --limit 1 --json databaseId --jq '.[0].databaseId')
883890
884891
if [ -z "$RUN_ID" ]; then
885892
echo "Error: Could not find workflow run ID"
@@ -893,11 +900,11 @@
893900
894901
# Try to watch the run, but handle network errors gracefully
895902
while true; do
896-
if gh run watch "$RUN_ID" --repo "$REPO" --exit-status; then
903+
if gh run watch "$RUN_ID" --exit-status; then
897904
break
898905
else
899906
echo "Network error while watching workflow. Retrying in 5 seconds..."
900-
echo "You can also check the status manually with: gh run view $RUN_ID --repo $REPO"
907+
echo "You can also check the status manually with: gh run view $RUN_ID"
901908
sleep 5
902909
fi
903910
done

0 commit comments

Comments
 (0)