Compare commits

..

1 Commits

Author SHA1 Message Date
github-actions b8a18885ad Update all 2025-12-01 05:11:24 +00:00
15 changed files with 25 additions and 258 deletions
-33
View File
@@ -15,39 +15,6 @@ 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/
+1 -10
View File
@@ -6,7 +6,7 @@
"+^v[3-9]+(\\.[0-9]+){0,2}$"
],
"branches": {
"main": "9255dc7a253b0ccc959486e2bca901246202afeb"
"main": "0057852bfaa89a56745cba8c7296529d2fc39830"
},
"defaultBranch": "main",
"tags": {
@@ -135,15 +135,6 @@
},
"v4.3.0": {
"commit": "0057852bfaa89a56745cba8c7296529d2fc39830"
},
"v5": {
"commit": "9255dc7a253b0ccc959486e2bca901246202afeb"
},
"v5.0.0": {
"commit": "a7833574556fa59680c1b7cb190c1735db73ebf0"
},
"v5.0.1": {
"commit": "9255dc7a253b0ccc959486e2bca901246202afeb"
}
}
}
+2 -5
View File
@@ -6,7 +6,7 @@
"+^v[0-9]+(\\.[0-9]+){0,2}$"
],
"branches": {
"main": "8e8c483db84b4bee98b60c0593521ed34d9990e8"
"main": "c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5"
},
"defaultBranch": "main",
"tags": {
@@ -170,13 +170,10 @@
"commit": "93cb6efe18208431cddfb8368fd83d5badbf9bfd"
},
"v6": {
"commit": "8e8c483db84b4bee98b60c0593521ed34d9990e8"
"commit": "1af3b93b6815bc44a9784bd300feb67ff0d1eeb3"
},
"v6.0.0": {
"commit": "1af3b93b6815bc44a9784bd300feb67ff0d1eeb3"
},
"v6.0.1": {
"commit": "8e8c483db84b4bee98b60c0593521ed34d9990e8"
}
}
}
+2 -5
View File
@@ -6,7 +6,7 @@
"+^v[0-9]+(\\.[0-9]+){0,2}$"
],
"branches": {
"main": "65d868f8d4d85d7d4abb7de0875cde3fcc8798f5"
"main": "b9b25d45f70a5d94d88496aa4896bf9ed8f49b67"
},
"defaultBranch": "main",
"tags": {
@@ -204,13 +204,10 @@
"commit": "a0853c24544627f65ddf259abe73b1d18a591444"
},
"v6": {
"commit": "395ad3262231945c25e8478fd5baf05154b1d79f"
"commit": "2028fbc5c25fe9cf00d9f06a71cc4710d4507903"
},
"v6.0.0": {
"commit": "2028fbc5c25fe9cf00d9f06a71cc4710d4507903"
},
"v6.1.0": {
"commit": "395ad3262231945c25e8478fd5baf05154b1d79f"
}
}
}
+1 -7
View File
@@ -6,7 +6,7 @@
"+^v[0-9]+(\\.[0-9]+){0,2}$"
],
"branches": {
"main": "b7c566a772e6b6bfb58ed0dc250532a479d7789f"
"main": "330a01c490aca151604b8cf639adc76d48f6c5d4"
},
"defaultBranch": "main",
"tags": {
@@ -146,12 +146,6 @@
},
"v5.0.0": {
"commit": "330a01c490aca151604b8cf639adc76d48f6c5d4"
},
"v6": {
"commit": "b7c566a772e6b6bfb58ed0dc250532a479d7789f"
},
"v6.0.0": {
"commit": "b7c566a772e6b6bfb58ed0dc250532a479d7789f"
}
}
}
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
set -e
script_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Minimum node version
$script_dir/internal/check-node.sh
# Add ignore tags to the action
node "$script_dir/internal/add-ignore-tags.js" $*
# Regenerate action scripts
$script_dir/internal/generate-scripts.sh
+2 -8
View File
@@ -1,7 +1,7 @@
mkdir actions_cache
pushd actions_cache
curl -s -S -L -o '9255dc7a253b0ccc959486e2bca901246202afeb.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/9255dc7a253b0ccc959486e2bca901246202afeb'
curl -s -S -L -o '9255dc7a253b0ccc959486e2bca901246202afeb.zip' 'https://api.github.com/repos/actions/cache/zipball/9255dc7a253b0ccc959486e2bca901246202afeb'
curl -s -S -L -o '0057852bfaa89a56745cba8c7296529d2fc39830.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/0057852bfaa89a56745cba8c7296529d2fc39830'
curl -s -S -L -o '0057852bfaa89a56745cba8c7296529d2fc39830.zip' 'https://api.github.com/repos/actions/cache/zipball/0057852bfaa89a56745cba8c7296529d2fc39830'
curl -s -S -L -o '6f8efc29b200d32929f49075959781ed54ec270c.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/6f8efc29b200d32929f49075959781ed54ec270c'
curl -s -S -L -o '6f8efc29b200d32929f49075959781ed54ec270c.zip' 'https://api.github.com/repos/actions/cache/zipball/6f8efc29b200d32929f49075959781ed54ec270c'
curl -s -S -L -o '4b0cf6cc4619e737324ddfcec08fff2413359514.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/4b0cf6cc4619e737324ddfcec08fff2413359514'
@@ -86,10 +86,4 @@ curl -s -S -L -o '0400d5f644dc74513175e3cd8d07132dd4860809.tar.gz' 'https://api.
curl -s -S -L -o '0400d5f644dc74513175e3cd8d07132dd4860809.zip' 'https://api.github.com/repos/actions/cache/zipball/0400d5f644dc74513175e3cd8d07132dd4860809'
curl -s -S -L -o '0057852bfaa89a56745cba8c7296529d2fc39830.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/0057852bfaa89a56745cba8c7296529d2fc39830'
curl -s -S -L -o '0057852bfaa89a56745cba8c7296529d2fc39830.zip' 'https://api.github.com/repos/actions/cache/zipball/0057852bfaa89a56745cba8c7296529d2fc39830'
curl -s -S -L -o '9255dc7a253b0ccc959486e2bca901246202afeb.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/9255dc7a253b0ccc959486e2bca901246202afeb'
curl -s -S -L -o '9255dc7a253b0ccc959486e2bca901246202afeb.zip' 'https://api.github.com/repos/actions/cache/zipball/9255dc7a253b0ccc959486e2bca901246202afeb'
curl -s -S -L -o 'a7833574556fa59680c1b7cb190c1735db73ebf0.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/a7833574556fa59680c1b7cb190c1735db73ebf0'
curl -s -S -L -o 'a7833574556fa59680c1b7cb190c1735db73ebf0.zip' 'https://api.github.com/repos/actions/cache/zipball/a7833574556fa59680c1b7cb190c1735db73ebf0'
curl -s -S -L -o '9255dc7a253b0ccc959486e2bca901246202afeb.tar.gz' 'https://api.github.com/repos/actions/cache/tarball/9255dc7a253b0ccc959486e2bca901246202afeb'
curl -s -S -L -o '9255dc7a253b0ccc959486e2bca901246202afeb.zip' 'https://api.github.com/repos/actions/cache/zipball/9255dc7a253b0ccc959486e2bca901246202afeb'
popd
+4 -6
View File
@@ -1,7 +1,7 @@
mkdir actions_checkout
pushd actions_checkout
curl -s -S -L -o '8e8c483db84b4bee98b60c0593521ed34d9990e8.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/8e8c483db84b4bee98b60c0593521ed34d9990e8'
curl -s -S -L -o '8e8c483db84b4bee98b60c0593521ed34d9990e8.zip' 'https://api.github.com/repos/actions/checkout/zipball/8e8c483db84b4bee98b60c0593521ed34d9990e8'
curl -s -S -L -o 'c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5'
curl -s -S -L -o 'c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5.zip' 'https://api.github.com/repos/actions/checkout/zipball/c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5'
curl -s -S -L -o '50fbc622fc4ef5163becd7fab6573eac35f8462e.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/50fbc622fc4ef5163becd7fab6573eac35f8462e'
curl -s -S -L -o '50fbc622fc4ef5163becd7fab6573eac35f8462e.zip' 'https://api.github.com/repos/actions/checkout/zipball/50fbc622fc4ef5163becd7fab6573eac35f8462e'
curl -s -S -L -o 'af513c7a016048ae468971c52ed77d9562c7c819.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/af513c7a016048ae468971c52ed77d9562c7c819'
@@ -106,10 +106,8 @@ curl -s -S -L -o '08c6903cd8c0fde910a37f88322edcfb5dd907a8.tar.gz' 'https://api.
curl -s -S -L -o '08c6903cd8c0fde910a37f88322edcfb5dd907a8.zip' 'https://api.github.com/repos/actions/checkout/zipball/08c6903cd8c0fde910a37f88322edcfb5dd907a8'
curl -s -S -L -o '93cb6efe18208431cddfb8368fd83d5badbf9bfd.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/93cb6efe18208431cddfb8368fd83d5badbf9bfd'
curl -s -S -L -o '93cb6efe18208431cddfb8368fd83d5badbf9bfd.zip' 'https://api.github.com/repos/actions/checkout/zipball/93cb6efe18208431cddfb8368fd83d5badbf9bfd'
curl -s -S -L -o '8e8c483db84b4bee98b60c0593521ed34d9990e8.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/8e8c483db84b4bee98b60c0593521ed34d9990e8'
curl -s -S -L -o '8e8c483db84b4bee98b60c0593521ed34d9990e8.zip' 'https://api.github.com/repos/actions/checkout/zipball/8e8c483db84b4bee98b60c0593521ed34d9990e8'
curl -s -S -L -o '1af3b93b6815bc44a9784bd300feb67ff0d1eeb3.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/1af3b93b6815bc44a9784bd300feb67ff0d1eeb3'
curl -s -S -L -o '1af3b93b6815bc44a9784bd300feb67ff0d1eeb3.zip' 'https://api.github.com/repos/actions/checkout/zipball/1af3b93b6815bc44a9784bd300feb67ff0d1eeb3'
curl -s -S -L -o '8e8c483db84b4bee98b60c0593521ed34d9990e8.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/8e8c483db84b4bee98b60c0593521ed34d9990e8'
curl -s -S -L -o '8e8c483db84b4bee98b60c0593521ed34d9990e8.zip' 'https://api.github.com/repos/actions/checkout/zipball/8e8c483db84b4bee98b60c0593521ed34d9990e8'
curl -s -S -L -o '1af3b93b6815bc44a9784bd300feb67ff0d1eeb3.tar.gz' 'https://api.github.com/repos/actions/checkout/tarball/1af3b93b6815bc44a9784bd300feb67ff0d1eeb3'
curl -s -S -L -o '1af3b93b6815bc44a9784bd300feb67ff0d1eeb3.zip' 'https://api.github.com/repos/actions/checkout/zipball/1af3b93b6815bc44a9784bd300feb67ff0d1eeb3'
popd
+4 -6
View File
@@ -1,7 +1,7 @@
mkdir actions_setup-node
pushd actions_setup-node
curl -s -S -L -o '65d868f8d4d85d7d4abb7de0875cde3fcc8798f5.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/65d868f8d4d85d7d4abb7de0875cde3fcc8798f5'
curl -s -S -L -o '65d868f8d4d85d7d4abb7de0875cde3fcc8798f5.zip' 'https://api.github.com/repos/actions/setup-node/zipball/65d868f8d4d85d7d4abb7de0875cde3fcc8798f5'
curl -s -S -L -o 'b9b25d45f70a5d94d88496aa4896bf9ed8f49b67.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/b9b25d45f70a5d94d88496aa4896bf9ed8f49b67'
curl -s -S -L -o 'b9b25d45f70a5d94d88496aa4896bf9ed8f49b67.zip' 'https://api.github.com/repos/actions/setup-node/zipball/b9b25d45f70a5d94d88496aa4896bf9ed8f49b67'
curl -s -S -L -o 'f1f314fca9dfce2769ece7d933488f076716723e.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/f1f314fca9dfce2769ece7d933488f076716723e'
curl -s -S -L -o 'f1f314fca9dfce2769ece7d933488f076716723e.zip' 'https://api.github.com/repos/actions/setup-node/zipball/f1f314fca9dfce2769ece7d933488f076716723e'
curl -s -S -L -o '0d7d2ca66539aca4af6c5102e29a33757e2c2d2c.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/0d7d2ca66539aca4af6c5102e29a33757e2c2d2c'
@@ -130,10 +130,8 @@ curl -s -S -L -o 'a0853c24544627f65ddf259abe73b1d18a591444.tar.gz' 'https://api.
curl -s -S -L -o 'a0853c24544627f65ddf259abe73b1d18a591444.zip' 'https://api.github.com/repos/actions/setup-node/zipball/a0853c24544627f65ddf259abe73b1d18a591444'
curl -s -S -L -o 'a0853c24544627f65ddf259abe73b1d18a591444.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/a0853c24544627f65ddf259abe73b1d18a591444'
curl -s -S -L -o 'a0853c24544627f65ddf259abe73b1d18a591444.zip' 'https://api.github.com/repos/actions/setup-node/zipball/a0853c24544627f65ddf259abe73b1d18a591444'
curl -s -S -L -o '395ad3262231945c25e8478fd5baf05154b1d79f.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/395ad3262231945c25e8478fd5baf05154b1d79f'
curl -s -S -L -o '395ad3262231945c25e8478fd5baf05154b1d79f.zip' 'https://api.github.com/repos/actions/setup-node/zipball/395ad3262231945c25e8478fd5baf05154b1d79f'
curl -s -S -L -o '2028fbc5c25fe9cf00d9f06a71cc4710d4507903.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/2028fbc5c25fe9cf00d9f06a71cc4710d4507903'
curl -s -S -L -o '2028fbc5c25fe9cf00d9f06a71cc4710d4507903.zip' 'https://api.github.com/repos/actions/setup-node/zipball/2028fbc5c25fe9cf00d9f06a71cc4710d4507903'
curl -s -S -L -o '395ad3262231945c25e8478fd5baf05154b1d79f.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/395ad3262231945c25e8478fd5baf05154b1d79f'
curl -s -S -L -o '395ad3262231945c25e8478fd5baf05154b1d79f.zip' 'https://api.github.com/repos/actions/setup-node/zipball/395ad3262231945c25e8478fd5baf05154b1d79f'
curl -s -S -L -o '2028fbc5c25fe9cf00d9f06a71cc4710d4507903.tar.gz' 'https://api.github.com/repos/actions/setup-node/tarball/2028fbc5c25fe9cf00d9f06a71cc4710d4507903'
curl -s -S -L -o '2028fbc5c25fe9cf00d9f06a71cc4710d4507903.zip' 'https://api.github.com/repos/actions/setup-node/zipball/2028fbc5c25fe9cf00d9f06a71cc4710d4507903'
popd
+2 -6
View File
@@ -1,7 +1,7 @@
mkdir actions_upload-artifact
pushd actions_upload-artifact
curl -s -S -L -o 'b7c566a772e6b6bfb58ed0dc250532a479d7789f.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/b7c566a772e6b6bfb58ed0dc250532a479d7789f'
curl -s -S -L -o 'b7c566a772e6b6bfb58ed0dc250532a479d7789f.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/b7c566a772e6b6bfb58ed0dc250532a479d7789f'
curl -s -S -L -o '330a01c490aca151604b8cf639adc76d48f6c5d4.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/330a01c490aca151604b8cf639adc76d48f6c5d4'
curl -s -S -L -o '330a01c490aca151604b8cf639adc76d48f6c5d4.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/330a01c490aca151604b8cf639adc76d48f6c5d4'
curl -s -S -L -o '3446296876d12d4e3a0f3145a3c87e67bf0a16b5.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/3446296876d12d4e3a0f3145a3c87e67bf0a16b5'
curl -s -S -L -o '3446296876d12d4e3a0f3145a3c87e67bf0a16b5.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/3446296876d12d4e3a0f3145a3c87e67bf0a16b5'
curl -s -S -L -o '3446296876d12d4e3a0f3145a3c87e67bf0a16b5.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/3446296876d12d4e3a0f3145a3c87e67bf0a16b5'
@@ -92,8 +92,4 @@ curl -s -S -L -o '330a01c490aca151604b8cf639adc76d48f6c5d4.tar.gz' 'https://api.
curl -s -S -L -o '330a01c490aca151604b8cf639adc76d48f6c5d4.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/330a01c490aca151604b8cf639adc76d48f6c5d4'
curl -s -S -L -o '330a01c490aca151604b8cf639adc76d48f6c5d4.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/330a01c490aca151604b8cf639adc76d48f6c5d4'
curl -s -S -L -o '330a01c490aca151604b8cf639adc76d48f6c5d4.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/330a01c490aca151604b8cf639adc76d48f6c5d4'
curl -s -S -L -o 'b7c566a772e6b6bfb58ed0dc250532a479d7789f.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/b7c566a772e6b6bfb58ed0dc250532a479d7789f'
curl -s -S -L -o 'b7c566a772e6b6bfb58ed0dc250532a479d7789f.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/b7c566a772e6b6bfb58ed0dc250532a479d7789f'
curl -s -S -L -o 'b7c566a772e6b6bfb58ed0dc250532a479d7789f.tar.gz' 'https://api.github.com/repos/actions/upload-artifact/tarball/b7c566a772e6b6bfb58ed0dc250532a479d7789f'
curl -s -S -L -o 'b7c566a772e6b6bfb58ed0dc250532a479d7789f.zip' 'https://api.github.com/repos/actions/upload-artifact/zipball/b7c566a772e6b6bfb58ed0dc250532a479d7789f'
popd
+2 -12
View File
@@ -26,12 +26,6 @@ class ActionConfig {
*/
patterns = []
/**
* Tag patterns to ignore during packaging
* @type {string[]|undefined}
*/
ignoreTags = undefined
/**
* Branch versions (ref to commit SHA)
* @type {{[ref: string]: string}}
@@ -69,13 +63,12 @@ exports.TagVersion = TagVersion
/**
* Adds a new action config file
* @param {string} owner
* @param {string} repo
* @param {string} repos
* @param {string[]} patternStrings
* @param {string} defaultBranch
* @param {string[]|undefined} ignoreTags
* @returns {Promise}
*/
async function add(owner, repo, patternStrings, defaultBranch, ignoreTags) {
async function add(owner, repo, patternStrings, defaultBranch) {
assert.ok(owner, "Arg 'owner' must not be empty")
assert.ok(repo, "Arg 'repo' must not be empty")
assert.ok(patternStrings, "Arg 'patternStrings' must not be null")
@@ -91,9 +84,6 @@ async function add(owner, repo, patternStrings, defaultBranch, ignoreTags) {
config.owner = owner
config.repo = repo
config.patterns = patternStrings
if (ignoreTags && ignoreTags.length > 0) {
config.ignoreTags = ignoreTags
}
config.defaultBranch = defaultBranch
const tempDir = path.join(paths.temp, `${owner}_${repo}`)
+4 -21
View File
@@ -14,7 +14,6 @@ async function main() {
const repo = args.repo
const patterns = args.patterns
const defaultBranch = args.defaultBranch || 'master'
const ignoreTags = args.ignoreTags
// File exists?
const file = actionConfig.getFilePath(owner, repo)
@@ -24,7 +23,7 @@ async function main() {
await fsHelper.reinitTemp()
// Add the config
await actionConfig.add(owner, repo, patterns, defaultBranch, ignoreTags)
await actionConfig.add(owner, repo, patterns, defaultBranch)
}
catch (err) {
// Help
@@ -51,7 +50,6 @@ class Args {
repo = ''
patterns = []
defaultBranch = ''
ignoreTags = []
}
/**
@@ -60,7 +58,7 @@ class Args {
*/
function getArgs() {
// Parse
const parsedArgs = argHelper.parse([], ['default-branch', 'ignore-tags'])
const parsedArgs = argHelper.parse([], ['default-branch'])
if (parsedArgs.arguments.length < 1) {
argHelper.throwError('Expected at least one arg')
}
@@ -83,32 +81,17 @@ function getArgs() {
}
}
// Parse ignore-tags (comma-separated version prefixes like v1,v2)
// These are converted to regex patterns that match the version and all its sub-versions
let ignoreTags = []
if (parsedArgs.options['ignore-tags']) {
const prefixes = parsedArgs.options['ignore-tags'].split(',').map(t => t.trim()).filter(t => t)
for (const prefix of prefixes) {
// Convert simple version prefix like "v1" to regex pattern "^v1(\\..*)?$"
// This matches "v1", "v1.0", "v1.0.0", etc.
const escapedPrefix = prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
ignoreTags.push(`^${escapedPrefix}(\\..*)?$`)
}
}
return {
owner: splitNwo[0],
repo: splitNwo[1],
patterns: patterns,
defaultBranch: parsedArgs.options['default-branch'],
ignoreTags: ignoreTags
defaultBranch: parsedArgs.options['default-branch']
}
}
function printUsage() {
console.error('USAGE: add-action.sh [--default-branch branch] [--ignore-tags versions] nwo [(+|-)regexp [...]]')
console.error('USAGE: add-action.sh [--default-branch branch] nwo [(+|-)regexp [...]]')
console.error(` --default-branch Default branch name. For example: master`)
console.error(` --ignore-tags Comma-separated version prefixes to ignore. For example: v1,v2`)
console.error(` nwo Name with owner. For example: actions/checkout`)
console.error(` regexp Refs to include or exclude. Default: ${actionConfig.defaultPatterns.join(' ')}`)
}
-105
View File
@@ -1,105 +0,0 @@
const actionConfig = require('./action-config')
const argHelper = require('./arg-helper')
const debugHelper = require('./debug-helper')
const fs = require('fs')
async function main() {
try {
// Command line args
const args = getArgs()
// Get the action config file
const file = actionConfig.getFilePath(args.owner, args.repo)
debugHelper.debug(`file: ${file}`)
// Load the config
const config = await actionConfig.loadFromPath(file)
// Add ignore tags
if (!config.ignoreTags) {
config.ignoreTags = []
}
// Add new patterns (avoid duplicates)
for (const pattern of args.ignoreTags) {
if (!config.ignoreTags.includes(pattern)) {
config.ignoreTags.push(pattern)
}
}
// Write config back
await fs.promises.writeFile(file, JSON.stringify(config, null, ' '))
console.log(`Updated config file: ${file}`)
console.log(` ignoreTags: ${JSON.stringify(config.ignoreTags)}`)
}
catch (err) {
// Help
if (err.code === argHelper.helpCode) {
printUsage()
return
}
// Arg error?
if (err.code === argHelper.errorCode) {
printUsage()
console.error('')
}
// Print error
debugHelper.debug(err.stack)
console.error(`ERROR: ${err.message}`)
process.exitCode = 1
}
}
class Args {
owner = ''
repo = ''
ignoreTags = []
}
/**
* Get the command line args
* @returns {Args}
*/
function getArgs() {
const parsedArgs = argHelper.parse([], ['ignore-tags'])
const result = new Args()
// Validate ignore-tags is provided
if (!parsedArgs.options['ignore-tags']) {
argHelper.throwError('--ignore-tags is required')
}
// Parse ignore-tags (comma-separated version prefixes like v1,v2)
const prefixes = parsedArgs.options['ignore-tags'].split(',').map(t => t.trim()).filter(t => t)
for (const prefix of prefixes) {
// Convert simple version prefix like "v1" to regex pattern "^v1(\\..*)?$"
// This matches "v1", "v1.0", "v1.0.0", etc.
const escapedPrefix = prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
result.ignoreTags.push(`^${escapedPrefix}(\\..*)?$`)
}
// Validate exactly one arg
if (parsedArgs.arguments.length !== 1) {
argHelper.throwError('Expected exactly one arg (nwo)')
}
const nwo = parsedArgs.arguments[0]
const splitNwo = nwo.split('/')
if (splitNwo.length !== 2 || !splitNwo[0] || !splitNwo[1]) {
argHelper.throwError(`Invalid nwo '${nwo}'`)
}
result.owner = splitNwo[0]
result.repo = splitNwo[1]
return result
}
function printUsage() {
console.error('USAGE: add-ignore-tags.sh --ignore-tags versions nwo')
console.error(` --ignore-tags Comma-separated version prefixes to ignore. For example: v1,v2`)
console.error(` nwo Name with owner. For example: actions/checkout`)
}
main()
-18
View File
@@ -40,10 +40,6 @@ for json_file in $script_dir/../../config/actions/*.json; do
curl_download_commands+=("curl -s -S -L -o '$sha.zip' 'https://api.github.com/repos/$owner/$repo/zipball/$sha'")
done
# Get an array of ignoreTags patterns (if present)
ignore_patterns=()
IFS=$'\n' read -r -d '' -a ignore_patterns < <( echo "$json" | jq --raw-output '.ignoreTags // [] | .[]' && printf '\0' )
# Get an array of tag info. Each item contains "<tag> <commit_sha>"
tag_info=()
IFS=$'\n' read -r -d '' -a tag_info < <( echo "$json" | jq --raw-output '.tags | to_entries | .[] | .key + " " + .value.commit' && printf '\0' )
@@ -53,20 +49,6 @@ for json_file in $script_dir/../../config/actions/*.json; do
tag="${split[0]}"
sha="${split[1]}"
# Check if the tag matches any ignore pattern
skip_tag=false
for pattern in "${ignore_patterns[@]}"; do
if [[ "$tag" =~ $pattern ]]; then
echo "Ignoring tag '$tag' (matches pattern '$pattern')"
skip_tag=true
break
fi
done
if [ "$skip_tag" = true ]; then
continue
fi
# Append curl download command
curl_download_commands+=("curl -s -S -L -o '$sha.tar.gz' 'https://api.github.com/repos/$owner/$repo/tarball/$sha'")
curl_download_commands+=("curl -s -S -L -o '$sha.zip' 'https://api.github.com/repos/$owner/$repo/zipball/$sha'")
+1 -2
View File
@@ -22,9 +22,8 @@ async function main() {
const repo = config.repo
const patterns = config.patterns
const defaultBranch = config.defaultBranch
const ignoreTags = config.ignoreTags
assert.ok(patterns && patterns.length, 'Existing patterns must not be empty')
await actionConfig.add(owner, repo, patterns, defaultBranch, ignoreTags)
await actionConfig.add(owner, repo, patterns, defaultBranch)
}
}
catch (err) {