Skip to content

Latest commit

 

History

History
183 lines (139 loc) · 4.94 KB

README.md

File metadata and controls

183 lines (139 loc) · 4.94 KB

Tool Versions Update Action - Commit

A GitHub Action to automatically update the tools in your .tool-versions file through a commit.

Usage

- uses: ericcornelissen/tool-versions-update-action/commit@v1
  with:
    # The branch to commit to.
    #
    # This input supports templating, see the "Templating" section for more
    # information.
    #
    # Default: *current or default branch*
    branch: develop

    # The message to use for commits.
    #
    # This input supports templating, see the "Templating" section for more
    # information.
    #
    # Default (1st line): "Update {{updated-tools}}"
    commit-message: |
      Update {{updated-count}} tool(s)

      Update {{updated-tools}}

    # The maximum number of tools to update. 0 indicates no maximum.
    #
    # Default: 0
    max: 2

    # A comma-separated list of tools that should NOT be updated.
    #
    # Default: ""
    not: actionlint,shfmt

    # A comma-separated list of tools that should be updated, ignoring others.
    #
    # Default: ""
    only: shellcheck

    # A newline-separated list of "plugin url" pairs that should be installed.
    # If omitted the default plugins will be available.
    #
    # Default: ""
    plugins: |
      actionlint https://github.com/crazy-matt/asdf-actionlint
      shellcheck https://github.com/luizm/asdf-shellcheck

    # Add "Signed-off-by" line at the end of the commit message. See `--signoff`
    # in <https://git-scm.com/docs/git-commit> for more detail.
    #
    # Default: false
    signoff: true

    # A newline-separated list of "tool version" pairs that should NOT be
    # updated to.
    #
    # Default: ""
    skip: |
      shfmt 3.6.0
      yamllint 1.31.0

    # The $GITHUB_TOKEN or a repository scoped Personal Access Token (PAT).
    #
    # Default: $GITHUB_TOKEN
    token: ${{ github.token }}

Outputs

The following outputs are made available:

Name Description
commit-sha The SHA identifier of the created commit
did-update true if at least one tool was updated, false otherwise
updated-count The number of tools that were updated
updated-new-versions A comma separated list of the new versions of updated tools
updated-old-versions A comma separated list of the old versions of updated tools
updated-tools A comma separated list of the names of the updated tools

For information on how to use outputs see the GitHub Actions output docs.

Templating

Some inputs support a simple templating language to embed outputs before use. To use a template variable use the string {{output-name}} in the input value, for example:

This template string uses the '{{updated-count}}' output

could become:

This template string uses the '3' output

The following inputs support templating:

  • branch
  • commit-message

The following outputs are available for templating:

  • updated-count
  • updated-new-versions
  • updated-old-versions
  • updated-tools

Full Example

This example is for a workflow that can be triggered manually to create a commit to update at most 2 tools defined in .tool-versions at the time.

name: Tooling
on:
  workflow_dispatch: ~

permissions: read-all

jobs:
  tooling:
    name: Update tooling
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Update tooling
        uses: ericcornelissen/tool-versions-update-action/commit@v1
        with:
          max: 2

Runners

This action is tested on the official ubuntu-20.04, ubuntu-22.04, and ubuntu-24.04 runner images. It is recommended to use one of these images when using this action.

Security

Permissions

This action requires the following permissions:

permissions:
  contents: write # To push a commit

Network

This action requires network access to:

github.com:443
objects.githubusercontent.com:443

in addition to any endpoints your asdf plugins use.


The contents of this document are licensed under CC BY 4.0, code snippets under the MIT-0 license.