Skip to main content

No project description provided

Project description

gha-tools

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install gha-tools

You can also use pipx to directly run gha-tools.

Usage

Automatically updating workflow action versions

Use gh-tools autoupdate on a workflow file or directory to automatically update the action versions to the latest available version.

  • By default, the command will not write changes to the file system; use --write to have it do that.
  • You can use --diff to see what changes would be made. This can be used in conjunction with --write.
  • You can use --version-strategy=specific to update to a specific latest version tag instead of the major tag, e.g. v1.2.3 instead of v1. The default is to use the major tag, when available.
    • You can use --first-party-version-strategy and --third-party-version-strategy to set different version strategies for first-party and third-party actions respectively.
$ gha-tools autoupdate --diff .github/workflows
Updating .github/workflows/publish.yml...
  No changes to .github/workflows/publish.yml.
Updating .github/workflows/ci.yml...
--- .github/workflows/ci.yml
+++ .github/workflows/ci.yml
@@ -34,7 +34,7 @@
             requirements*txt
       - run: 'pip install -e . -r requirements-test.txt'
       - run: py.test -vvv --cov .
-      - uses: codecov/codecov-action@v2
+      - uses: codecov/codecov-action@v3

   Lint:
     runs-on: ubuntu-20.04

Version pinning

GitHub Actions best practice is to pin the versions of actions to a specific version SHA, as tags may be mutable. You can use --pin to have gha-tools autoupdate pin the action to the latest commit SHA for the specified version tag. If you trust the first-party actions to use immutable tags, use --pin=third_party; otherwise use --pin=all.

$ gha-tools autoupdate --pin=third_party --diff .github/workflows
Updating .github/workflows/test.yml...
--- .github/workflows/test.yml
+++ .github/workflows/test.yml
@@ -12,13 +12,13 @@
   lint:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v3
-      - uses: akx/pre-commit-uv-action@v0.1.0
+      - uses: actions/checkout@v5
+      - uses: akx/pre-commit-uv-action@19e2cbdb93404ff82f52044f07306443bc0bff7a # v0.1.0

Separate version strategies

You can use different version strategies for first-party and third-party actions. For example, to keep first-party actions on major versions but use specific versions for third-party actions:

$ gha-tools autoupdate --first-party-version-strategy=major --third-party-version-strategy=specific --diff .github/workflows
Updating .github/workflows/test.yml...
--- .github/workflows/test.yml
+++ .github/workflows/test.yml
@@ -5,6 +5,6 @@
     steps:
-      - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
-      - uses: codecov/codecov-action@v3
+      - uses: actions/checkout@v5
+      - uses: actions/setup-python@v6
+      - uses: codecov/codecov-action@v5.5.1

GitHub Rate Limiting

Since this tool uses the GitHub API, you may run into rate limiting issues. You can specify your GitHub authentication via the environment variable GITHUB_TOKEN or GITHUB_AUTH.

If the value of the environment variable contains a colon (:), it will be interpreted as a username and password; this is useful with Personal Access Tokens, which are used with your GitHub username.

License

gha-tools is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gha_tools-0.3.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gha_tools-0.3.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file gha_tools-0.3.0.tar.gz.

File metadata

  • Download URL: gha_tools-0.3.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gha_tools-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1a5931d8ba756c11468680ff5ba390827e22424e2855ba200bf99cc5f7520818
MD5 c19360a16f6a10fa66f727facd503f21
BLAKE2b-256 4e3865d3afeae53c4320ebbddb4992966676dbcce784b5939393d351887a1e56

See more details on using hashes here.

Provenance

The following attestation bundles were made for gha_tools-0.3.0.tar.gz:

Publisher: ci.yml on akx/gha-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gha_tools-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gha_tools-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gha_tools-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de74c93b2f8c1cffcfb9f54c739ce3df0a91816fdce8fbb7f8e1f0c46603672a
MD5 6e5cfa1a6b215f412780501e6affc564
BLAKE2b-256 be712d7164b62e99a541c54c17135f218710c15981559915e8594db9f35a152c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gha_tools-0.3.0-py3-none-any.whl:

Publisher: ci.yml on akx/gha-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page