From 46648b433ab1afcbd37c811b97df0f2de9395e32 Mon Sep 17 00:00:00 2001 From: Billy Lynch Date: Tue, 19 Aug 2025 17:39:59 -0400 Subject: [PATCH] Add log grouping + error annotations Should hopefully make logs clearer to see what is going on. --- action.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/action.yaml b/action.yaml index 99bcb3c..0cda40d 100644 --- a/action.yaml +++ b/action.yaml @@ -121,22 +121,33 @@ runs: CHAINCTL_CONFIG: ${{ inputs.config-path }} EXPORT_AUTH: ${{ inputs.env-auth }} run: | + echo "::group::Authenticating with Chainguard as ${{ env.IDENTITY }}" if chainctl auth login --identity "${{ env.IDENTITY }}" -v=${{ env.VERBOSITY }}; then echo Logged in as ${{ env.IDENTITY }}! else - echo Unable to assume the identity ${{ env.IDENTITY }}. + echo "::error Unable to assume the identity ${{ env.IDENTITY }}." exit 1 fi + echo "::endgroup::" + + echo "::group::Authenticating with apk.cgr.dev as ${{ env.IDENTITY }}" if ! chainctl auth login --identity "${{ env.IDENTITY }}" --audience ${{ inputs.apk-host }} -v=${{ env.VERBOSITY }}; then - echo Unable to assume the identity ${{ env.IDENTITY }} for ${{ inputs.apk-host }}. + echo "::error Unable to assume the identity ${{ env.IDENTITY }} for ${{ inputs.apk-host }}." exit 1 fi + echo "::endgroup::" + + echo "::group::Registering docker credential helper" if ! chainctl auth configure-docker --identity "${{ env.IDENTITY }}" -v=${{ env.VERBOSITY }}; then - echo Unable to register credential helper as ${{ env.IDENTITY }}. + echo "::error Unable to register credential helper as ${{ env.IDENTITY }}." exit 1 fi + echo "::endgroup::" + if [ "${{ env.EXPORT_AUTH }}" == "true" ]; then - echo HTTP_AUTH="basic:${{ inputs.apk-host }}:user:$(chainctl auth token --audience ${{ inputs.apk-host }})" >> $GITHUB_ENV + echo "::group::Exporting HTTP_AUTH environment variable for ${{ inputs.apk-host }}" + echo HTTP_AUTH="basic:apk.cgr.dev:user:$(chainctl auth token --audience ${{ inputs.apk-host }})" >> $GITHUB_ENV + echo "::endgroup::" fi - name: Authenticate with Chainguard (DEPRECATED invite-code)