{"id":31760592,"url":"https://github.com/managedkaos/get-action-version-number","last_synced_at":"2025-10-09T21:32:58.232Z","repository":{"id":307933504,"uuid":"1031118057","full_name":"managedkaos/get-action-version-number","owner":"managedkaos","description":"A function to get the latest version of a published GitHub Action.","archived":false,"fork":false,"pushed_at":"2025-09-04T05:47:32.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-11T08:45:51.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/managedkaos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-03T03:43:19.000Z","updated_at":"2025-09-04T05:47:35.000Z","dependencies_parsed_at":"2025-08-03T06:20:57.641Z","dependency_job_id":"6c210922-1119-4891-9d8c-944c1da0d449","html_url":"https://github.com/managedkaos/get-action-version-number","commit_stats":null,"previous_names":["managedkaos/get-action-version-number"],"tags_count":0,"template":false,"template_full_name":"managedkaos/python-container-template","purl":"pkg:github/managedkaos/get-action-version-number","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedkaos%2Fget-action-version-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedkaos%2Fget-action-version-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedkaos%2Fget-action-version-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedkaos%2Fget-action-version-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/managedkaos","download_url":"https://codeload.github.com/managedkaos/get-action-version-number/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedkaos%2Fget-action-version-number/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002057,"owners_count":26083286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-09T21:30:59.726Z","updated_at":"2025-10-09T21:32:58.226Z","avatar_url":"https://github.com/managedkaos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Action Version Lookup\n\n[![Build and Push Image](https://github.com/managedkaos/get-action-version-number/actions/workflows/publish-image-to-ghcr.yml/badge.svg)](https://github.com/managedkaos/get-action-version-number/actions/workflows/publish-image-to-ghcr.yml)\n\nA Python-based application that looks up the latest version of GitHub Actions using the GitHub API.\n\n## Features\n\n- Look up the latest version of a single GitHub Action\n- Process multiple actions from a file\n- Extract and process actions directly from GitHub workflow files\n- Update workflow files in place with latest action versions\n- Support for both authenticated and unauthenticated API requests\n- Handles various action formats (with or without version)\n- JSON output format with `--json` flag\n- Enhanced text output showing both old and new versions\n\n## Installation\n\n1. Clone this repository\n2. Install dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## Usage\n\n### Single Action\n\nLook up the latest version of a single action:\n\n```bash\npython main.py \"actions/checkout@v4\"\n```\n\nOutput:\n\n```bash\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\n```\n\n### Single Action with JSON Output\n\nGet JSON format with action as key and latest version as value:\n\n```bash\npython main.py \"actions/checkout@v4\" --json\n```\n\nOutput:\n\n```json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v4.2.2\"\n}\n```\n\n### Action without Version\n\nLook up the latest version when no version is specified:\n\n```bash\npython main.py \"actions/setup-python\"\n```\n\nOutput:\n\n```bash\nactions/setup-python -\u003e actions/setup-python@v6.0.0\n```\n\n### Process File\n\nProcess multiple actions from a file (one per line):\n\n```bash\npython main.py -f actions.txt\n```\n\n### Process File with JSON Output\n\nGet JSON format for file processing:\n\n```bash\npython main.py -f actions.txt --json\n```\n\nOutput:\n\n```json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v4.2.2\",\n  \"actions/setup-python@v5\": \"actions/setup-python@v5.6.0\",\n  \"docker/build-push-action@v5\": \"docker/build-push-action@v6.18.0\"\n}\n```\n\n### Process Workflow File\n\nExtract and process actions directly from a GitHub workflow file:\n\n```bash\npython main.py -w workflow.yml\n```\n\nOutput:\n\n```bash\nactions/checkout@v4.2.2\nactions/setup-go@v5.5.0\n```\n\n### Process Workflow File with JSON Output\n\nGet JSON format for workflow processing:\n\n```bash\npython main.py -w workflow.yml --json\n```\n\nOutput:\n\n```json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v4.2.2\",\n  \"actions/setup-go@v5.5.0\": \"actions/setup-go@v5.5.0\"\n}\n```\n\n### Update Workflow File In Place\n\nUpdate a workflow file directly with the latest action versions:\n\n```bash\npython main.py -w workflow.yml --update-in-place\n```\n\nThis will:\n\n1. Read the workflow file\n2. Check each action's current version against the latest available version\n3. Update the file with newer versions where available\n4. Preserve all other content (comments, formatting, etc.)\n\nOutput:\n\n```bash\nUpdated actions/checkout: v4 -\u003e v5.0.0\nUpdated actions/setup-python: v5 -\u003e v6.0.0\n\nWorkflow file updated successfully. 2 action(s) updated.\n```\n\nIf no updates are needed:\n\n```bash\nNo updates needed - all actions are already at their latest versions.\n```\n\n**Note**: `--update-in-place` can only be used with `--workflow` and cannot be combined with `--json`.\n\n### Authenticated Requests\n\nFor better rate limits and access to private repositories, use a GitHub token:\n\n```bash\n# Using command line argument\npython main.py \"actions/checkout@v4\" --token YOUR_GITHUB_TOKEN\n\n# Using environment variable\nexport GITHUB_TOKEN=your_token_here\npython main.py \"actions/checkout@v4\"\n\n# With JSON output\npython main.py \"actions/checkout@v4\" --json --token YOUR_GITHUB_TOKEN\n\n# With workflow file\npython main.py -w workflow.yml --token YOUR_GITHUB_TOKEN\n\n# With workflow file and JSON output\npython main.py -w workflow.yml --json --token YOUR_GITHUB_TOKEN\n\n# Update workflow file in place\npython main.py -w workflow.yml --update-in-place --token YOUR_GITHUB_TOKEN\n```\n\n### Interactive Mode\n\nRun with `--stdin` flag to read from stdin:\n\n```bash\npython main.py --stdin\n```\n\nThen enter action strings one per line (Ctrl+D to finish).\n\nFor JSON output in stdin mode:\n\n```bash\npython main.py --stdin --json\n```\n\n### Piping Input\n\nYou can pipe action strings to the script without any flags - it will automatically detect piped input:\n\n```bash\necho -e \"actions/checkout@v4\\nactions/setup-python\" | python main.py\n```\n\nOutput:\n\n```bash\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\nactions/setup-python -\u003e actions/setup-python@v6.0.0\n```\n\nWith JSON output:\n\n```bash\necho -e \"actions/checkout@v4\\nactions/setup-python\" | python main.py --json\n```\n\nOutput:\n\n```json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v4.2.2\",\n  \"actions/setup-python\": \"actions/setup-python@v5.6.0\"\n}\n```\n\n**Note**: The `--stdin` flag is only needed for interactive mode (typing at the terminal). Piped input is automatically detected.\n\n## Input Format\n\nThe script accepts action strings in these formats:\n\n- `owner/repo@version` (e.g., `actions/checkout@v4`)\n- `owner/repo` (e.g., `actions/setup-python`)\n- `uses: owner/repo@version` (handles GitHub workflow format)\n\n## Output Format\n\n### Standard Output\n\nThe script outputs results in these formats:\n\n- `original_version -\u003e latest_version` (shows both old and new versions)\n- `original_version -\u003e No releases found` (when no releases are found)\n- `Error: message` (when parsing fails)\n\n### JSON Output\n\nWith the `--json` flag, the script outputs:\n\n```json\n{\n  \"original_action\": \"latest_version\",\n  \"actions/checkout@v4\": \"actions/checkout@v4.2.2\",\n  \"actions/setup-python\": \"actions/setup-python@v5.6.0\"\n}\n```\n\n## File Processing\n\nWhen processing a file, the script:\n\n- Skips empty lines\n- Skips lines starting with `#` (comments)\n- Continues processing even if some actions fail\n- Supports both standard and JSON output formats\n\n## Command Line Options\n\n- `action`: Action string in format 'owner/repo@version' or 'owner/repo'\n- `-f, --file`: File containing one action per line\n- `-w, --workflow`: GitHub workflow file to extract and process actions from\n- `--stdin`: Read action strings from stdin (interactive mode only)\n- `--token`: GitHub token for authenticated requests (optional)\n- `--json`: Output results in JSON format\n- `--update-in-place`: Update workflow file in place with latest action versions (only works with --workflow)\n- `-h, --help`: Show help message\n\n## Error Handling\n\nThe script handles various error conditions:\n\n- Invalid action format\n- Network errors\n- Missing files\n- GitHub API errors\n- Rate limiting (with appropriate delays)\n\n## Examples\n\n### Example 1: Single Action\n\n```bash\n$ python main.py \"actions/checkout@v4\"\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\n\n$ python main.py \"actions/checkout@v4\" --json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v5.0.0\"\n}\n```\n\n### Example 2: File Processing\n\n```bash\n$ python main.py -f actions.txt\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\nactions/setup-python@v5 -\u003e actions/setup-python@v6.0.0\ndocker/build-push-action@v5 -\u003e docker/build-push-action@v6.18.0\n\n$ python main.py -f actions.txt --json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v5.0.0\",\n  \"actions/setup-python@v5\": \"actions/setup-python@v6.0.0\",\n  \"docker/build-push-action@v5\": \"docker/build-push-action@v6.18.0\"\n}\n```\n\n### Example 3: Workflow File Processing\n\n```bash\n$ python main.py -w workflow.yml\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\nactions/setup-go@v5.5.0 -\u003e actions/setup-go@v6.0.0\n\n$ python main.py -w workflow.yml --json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v5.0.0\",\n  \"actions/setup-go@v5.5.0\": \"actions/setup-go@v6.0.0\"\n}\n```\n\n### Example 4: Update Workflow In Place\n\n```bash\n$ python main.py -w workflow.yml --update-in-place\nUpdated actions/checkout: v4 -\u003e v5.0.0\nUpdated actions/setup-python: v5 -\u003e v6.0.0\n\nWorkflow file updated successfully. 2 action(s) updated.\n\n$ python main.py -w workflow.yml --update-in-place\nNo updates needed - all actions are already at their latest versions.\n```\n\n### Example 5: Interactive Mode\n\n```bash\n$ python main.py --stdin\nEnter action strings (one per line, Ctrl+D to finish):\nactions/checkout@v4\nactions/setup-python\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\nactions/setup-python -\u003e actions/setup-python@v6.0.0\n\n$ python main.py --stdin --json\nEnter action strings (one per line, Ctrl+D to finish):\nactions/checkout@v4\nactions/setup-python\n{\n  \"actions/checkout@v4\": \"actions/checkout@v5.0.0\",\n  \"actions/setup-python\": \"actions/setup-python@v6.0.0\"\n}\n```\n\n### Example 6: Piping Input\n\n```bash\n$ echo -e \"actions/checkout@v4\\nactions/setup-python\" | python main.py\nactions/checkout@v4 -\u003e actions/checkout@v5.0.0\nactions/setup-python -\u003e actions/setup-python@v6.0.0\n\n$ echo -e \"actions/checkout@v4\\nactions/setup-python\" | python main.py --json\n{\n  \"actions/checkout@v4\": \"actions/checkout@v5.0.0\",\n  \"actions/setup-python\": \"actions/setup-python@v6.0.0\"\n}\n```\n\n## GitHub Token\n\nTo get a GitHub token:\n\n1. Go to GitHub Settings \u003e Developer settings \u003e Personal access tokens\n2. Generate a new token with `repo` scope for private repositories\n3. Use the token with the `--token` argument or set the `GITHUB_TOKEN` environment variable\n\n## Rate Limiting\n\n- Unauthenticated requests: 60 requests per hour\n- Authenticated requests: 5,000 requests per hour\n\nThe script will handle rate limiting gracefully and continue processing.\n\n## Dependencies\n\n- `requests\u003e=2.31.0` - For HTTP requests to GitHub API\n\n## License\n\nThis project is licensed under the MIT License - [see the LICENSE file for details](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanagedkaos%2Fget-action-version-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanagedkaos%2Fget-action-version-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanagedkaos%2Fget-action-version-number/lists"}