Skip to content

Expose target=human-readable to Github Action workflow or provide verbose flag #213

Description

@matthiashermsen

What is this feature about?

It would be great to see some optional debug information when running the workflow. In some validated environments I've seen workflow steps similiar to this one

          - name: Validate next version
            if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
            run: |
              NEXT_VERSION="${{ steps.get_next_version.outputs.version }}"
              LATEST_VERSION=$(git tag --list \
                | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \
                | sort -V \
                | tail -n 1)

              echo "Latest release tag: $LATEST_VERSION"
              echo "Next version:       $NEXT_VERSION"

              if git rev-parse "refs/tags/$NEXT_VERSION" >/dev/null 2>&1; then
                echo "::error::Version $NEXT_VERSION already exists as a Git tag."
                exit 1
              fi

              if [ -n "$LATEST_VERSION" ] && \
                [ "$(printf '%s\n' "$LATEST_VERSION" "$NEXT_VERSION" | sort -V | head -n 1)" != "$LATEST_VERSION" ]; then
                echo "::error::Next version $NEXT_VERSION is not greater than latest release $LATEST_VERSION."
                exit 1
              fi

              echo "Version $NEXT_VERSION is valid."

which basically only ensures that this action is working correctly... It feels redundant and could be omitted by adding a verbose flag or having some human readable output.

Using the CLI one can use target=human-readable but the Github Action only writes to the Github Actions output stream.

What do you think about this feature?

What needs to be done to implement this feature?

  • Update GitHub Action to accept a verbose flag printing some result information.
with:
  # e.g.
  verbose: true #defaults to false

What else should we know?

One could simply add a repository secret ACTIONS_STEP_DEBUG with the value true to see the expected output

##[debug]Docker Action run completed with exit code 0
##[debug]Set output version = 1.2.3
##[debug]Set output hasNextVersion = true
##[debug]Finishing: Get next version

but now every step is running in debug mode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions