Add ignoreTags support to exclude old versions from packaging (#118)

* Add ignoreTags support to exclude old versions from packaging

Co-authored-by: TingluoHuang <[email protected]>

* Add ignoreTags support to add-action and update-action scripts

Co-authored-by: TingluoHuang <[email protected]>

* Fix JSDoc typo and add regex validation for ignore-tags patterns

Co-authored-by: TingluoHuang <[email protected]>

* Simplify --ignore-tags to accept version prefixes instead of regex patterns

Co-authored-by: TingluoHuang <[email protected]>

* Add helper script to add ignoreTags to existing actions and fix JSON syntax in README

Co-authored-by: TingluoHuang <[email protected]>

* Remove --all flag from add-ignore-tags.sh, require specific action

Co-authored-by: TingluoHuang <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: TingluoHuang <[email protected]>
This commit is contained in:
Copilot
2025-12-09 10:30:43 -05:00
committed by GitHub
co-authored by copilot-swe-agent[bot] <198982749+[email protected]> TingluoHuang
parent 40447878b4
commit ab7f3a1ca8
7 changed files with 205 additions and 7 deletions
+33
View File
@@ -15,6 +15,39 @@ Preview versions are intentionally excluded. For example: `v2-beta`
Optional args may be supplied to control which refs are included. See `script/add-action.sh --help` for more info.
### Ignoring old versions
To exclude certain old version tags from being packaged, add an `ignoreTags` array to the action config JSON file. Each entry is a regex pattern that will be tested against tag names.
**When adding a new action**, use the `--ignore-tags` option with simple version prefixes:
```bash
./script/add-action.sh --ignore-tags "v1,v2" actions/checkout
```
This will automatically generate regex patterns that match `v1`, `v1.x`, `v2`, `v2.x`, etc.
**For existing actions**, use the helper script to add ignore tags:
```bash
./script/add-ignore-tags.sh --ignore-tags "v1,v2" actions/checkout
```
Or add `ignoreTags` directly to the JSON config file:
```json
{
"owner": "actions",
"repo": "checkout",
"ignoreTags": [
"^v1(\\..*)?$",
"^v2(\\..*)?$"
]
}
```
Tags matching any of the patterns will be excluded from the generated scripts while remaining in the config for historical reference. The `ignoreTags` field is preserved when running `update-action.sh`.
### How to use this in the self-hosted runner?
Please read the doc @kenmuse has put together at: https://www.kenmuse.com/blog/building-github-actions-runner-images-with-an-action-archive-cache/