Skip to content

Commit dec4d45

Browse files
Merge branch 'trial-testing:main' into main
2 parents a00c439 + 628eaa7 commit dec4d45

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

β€Ž.github/workflows/auth_try.ymlβ€Ž

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,47 +29,32 @@ jobs:
2929
token=$(echo "$raw" | jq -r '.value')
3030
echo "TOKEN=$token" >> $GITHUB_ENV
3131
32-
# 2. Checkout the PR head (untrusted code)
33-
- name: πŸ”„ Checkout PR head
32+
# 2. Checkout the PR head at the exact commit
33+
- name: πŸ”„ Checkout PR head at exact commit
3434
uses: actions/checkout@v3
3535
with:
3636
repository: ${{ github.event.pull_request.head.repo.full_name }}
37-
ref: ${{ github.event.pull_request.head.ref }}
37+
ref: ${{ github.event.pull_request.head.sha }}
3838
fetch-depth: 0
3939

40-
# 3. Send a simple GET request to "/"
41-
- name: πŸ“‘ Send GET request to protected root endpoint
42-
run: |
43-
echo "πŸš€ GET $API_BASE/"
44-
response=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_BASE/")
45-
echo "πŸ” GET response:"
46-
echo "$response" | jq . || true
47-
48-
49-
50-
51-
# 4. Collect & inspect changed JSON files (fixed)
40+
# 3. Collect & inspect changed JSON files (fixed)
5241
- name: πŸ“ Collect & inspect changed JSON files
5342
id: prepare_json_files
5443
run: |
5544
echo "πŸ” Finding changed JSON files..."
5645
BASE_BRANCH=${{ github.event.pull_request.base.ref }}
5746
echo "Base branch: $BASE_BRANCH"
5847
59-
# 1) Fetch the latest main so origin/main is up to date
6048
git fetch origin $BASE_BRANCH
6149
echo "βœ… Fetched origin/$BASE_BRANCH"
6250
63-
# 2) Diff using three-dot syntax against HEAD
6451
all_changed=$(git diff --name-only origin/$BASE_BRANCH...HEAD)
6552
echo "πŸ” All changed files in PR:"
6653
echo "$all_changed"
6754
68-
# 3) Filter for .json
6955
mapfile -t files < <(echo "$all_changed" | grep '\.json$' || true)
7056
echo "🧾 JSON files to process (${#files[@]}): ${files[*]:-<none>}"
7157
72-
# 4) Build the JSON array
7358
json_array="["
7459
for file in "${files[@]}"; do
7560
echo "πŸ“„ Checking $file"
@@ -81,15 +66,21 @@ jobs:
8166
fi
8267
done
8368
json_array="${json_array%,}]"
84-
85-
# 5) Debug and save
8669
echo "βœ… Final JSON array:"
8770
echo "$json_array"
8871
echo "$json_array" > files_payload.json
8972
echo "JSON_PAYLOAD_PATH=files_payload.json" >> $GITHUB_ENV
9073
echo "βœ… Payload size: $(wc -c < files_payload.json) bytes"
9174
9275
76+
# 3. Send a simple GET request to "/"
77+
- name: πŸ“‘ Send GET request to protected root endpoint
78+
run: |
79+
echo "πŸš€ GET $API_BASE/"
80+
response=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_BASE/")
81+
echo "πŸ” GET response:"
82+
echo "$response" | jq . || true
83+
9384
9485
# 5. Send POST request with JSON payload to "/"
9586
- name: πŸš€ Send POST request with JSON payload to root

0 commit comments

Comments
Β (0)