Skip to content

A tool to automatically update your github actions.

License

Notifications You must be signed in to change notification settings

GitHubToolbox/update-actions-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHubToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

A Python script to automate the updating of GitHub Actions in a specified folder by checking for newer versions on GitHub and updating the pinned versions based on their commit SHAs. This tool is useful for keeping GitHub Actions up-to-date across multiple workflows in a repository.

Features

  • Automatic Version Updates: Checks for the latest version of each GitHub Action and updates to the latest version if available.
  • Dry Run Mode: Preview changes without modifying any files.
  • Backup Creation: Optionally create backups of modified files before updates.
  • Recursive Directory Scan: Supports scanning all subdirectories for GitHub Actions.
  • Rate Limit Handling: Automatically detects GitHub API rate limits and waits or skips requests accordingly.
  • Verbose Output: Provides detailed information about the update process.

Prerequisites

This script requires Python 3.6 or higher. The following Python packages are also needed:

  • requests: For making HTTP requests to the GitHub API.
  • packaging: For handling version comparison.
  • tabulate: For displaying summary statistics in a table format.

Installation

  1. Clone this repository:

    git clone https://github.com/GitHubToolbox/github-actions-updater.git
    cd github-actions-updater
  2. Install the required packages using pip:

    pip install requests packaging tabulate

Usage

Run the script with the following command-line arguments:

python github_actions_updater.py --path <folder_path> [OPTIONS]

Command-Line Arguments

  • --path: (Optional) Path to the folder containing GitHub Actions files. Default is the current directory (.).
  • --github-token: (Optional) GitHub personal access token for authenticated requests. Provides higher API rate limits.
  • --dry-run: (Optional) If specified, prints changes without modifying files.
  • --backup: (Optional) If specified, creates a backup of each file before updating.
  • --extensions: (Optional) Comma-separated list of file extensions to check. Default is yml,yaml.
  • --recursive: (Optional) If specified, recursively searches subdirectories.
  • --verbose: (Optional) If specified, prints detailed information about the update process.

Examples

  1. Basic Usage:

    Update GitHub Actions in the current directory:

    python github_actions_updater.py --path .
  2. Dry Run:

    Preview changes without making any updates:

    python github_actions_updater.py --path /path/to/folder --dry-run
  3. Recursive Search:

    Search all subdirectories for GitHub Actions files:

    python github_actions_updater.py --path /path/to/folder --recursive
  4. With Backup:

    Create a backup before updating any files:

    python github_actions_updater.py --path /path/to/folder --backup
  5. Authenticated Requests:

    Use a GitHub token to increase the rate limit:

    python github_actions_updater.py --path /path/to/folder --github-token YOUR_GITHUB_TOKEN

Handling GitHub API Rate Limits

The script handles rate limits by checking the GitHub API response. If the rate limit is reached, it will either wait until the rate limit resets or skip further API requests, depending on the configured behaviour.

For more frequent updates or larger repositories, it is recommended to use a GitHub personal access token with the --github-token option to increase the rate limit.


About

A tool to automatically update your github actions.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  
  •  

Packages

No packages published

Languages