Skip to content

Commit 0d18d6d

Browse files
committed
Rework action.sh script
1 parent 7658913 commit 0d18d6d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

action.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ if [ ! "$(command -v dart)" ] && [ ! "$(command -v flutter)" ]; then
1111
exit 1
1212
fi
1313

14-
log_group_start() {
15-
echo "::group::${1}"
16-
}
17-
log_group_end() {
18-
echo "::endgroup::"
19-
}
20-
21-
echo "Create the OIDC token used for pub.dev publishing..."
2214
INPUT_GITHUB_OIDC_AUDIENCE="https://pub.dev"
15+
16+
# Request the GitHub OIDC token
2317
GITHUB_OIDC_RESPONSE=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${INPUT_GITHUB_OIDC_AUDIENCE}")
18+
if [[ $? -ne 0 ]]; then
19+
echo "::error::Failed to request the GitHub OIDC token,"
20+
exit 1
21+
fi
22+
23+
# Extract the GitHub OIDC token
2424
GITHUB_OIDC_IDTOKEN=$(jq -r '.value' <<< "${GITHUB_OIDC_RESPONSE}")
25+
26+
# Set PUB_TOKEN environment variable
2527
export PUB_TOKEN=${GITHUB_OIDC_IDTOKEN}
2628
echo "PUB_TOKEN=${GITHUB_OIDC_IDTOKEN}" >> $GITHUB_ENV
2729
echo "The Dart CLI successfully authenticated with the GitHub OIDC token,"

0 commit comments

Comments
 (0)