Skip to content

Commit a837e58

Browse files
committed
try again
1 parent a74c936 commit a837e58

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,22 @@ jobs:
202202
echo "ref=${{ github.ref }}"
203203
echo "event=${{ github.event_name }}"
204204
echo "head=${{ github.event.pull_request.head.repo.full_name }}"
205+
if [ -z "$ACTIONS_ID_TOKEN_REQUEST_URL" ] || [ -z "$ACTIONS_ID_TOKEN_REQUEST_TOKEN" ]; then
206+
echo "OIDC env missing"
207+
exit 0
208+
fi
205209
token_json=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
206210
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=sts.amazonaws.com" || true)
207-
if [ -z "$token_json" ]; then
211+
if [ -z "$token_json" ] || [ "$token_json" = "null" ]; then
208212
echo "OIDC token missing"
209213
exit 0
210214
fi
211-
python - <<'PY'
212-
import base64,json,sys
213-
token_json = sys.stdin.read()
215+
OIDC_TOKEN_JSON="$token_json" python - <<'PY'
216+
import base64,json,os,sys
217+
token_json = os.environ.get("OIDC_TOKEN_JSON","")
218+
if not token_json:
219+
print("OIDC token missing")
220+
sys.exit(0)
214221
token = json.loads(token_json).get("value","")
215222
if not token:
216223
print("OIDC token missing")
@@ -221,7 +228,6 @@ jobs:
221228
print(f"oidc.aud={data.get('aud')}")
222229
print(f"oidc.sub={data.get('sub')}")
223230
PY
224-
<<<"$token_json"
225231
226232
- name: Determine Docker tag
227233
id: docker-tag

0 commit comments

Comments
 (0)