Skip to content

Commit da68c3f

Browse files
fix: broaden version regex and add build job least-privilege permissions
- Fix regex to correctly accept rc, .dev, and .post PEP 440 forms - Add permissions: contents: read to the build job Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 92494d0 commit da68c3f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/release-splunk-ao-a2a.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Version to release (e.g., 0.1.0, 1.2.3). Must be an explicit PEP 440 version — bump keywords like "patch" or "minor" are not accepted.'
7+
description: 'Version to release (e.g., 0.1.0, 1.2.3, 1.2.3rc1, 1.2.3.post1). Must be an explicit version — bump keywords like "patch" or "minor" are not accepted.'
88
required: true
99
type: string
1010

1111
jobs:
1212
build:
1313
name: Build package
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
1517
defaults:
1618
run:
1719
working-directory: splunk-ao-a2a
@@ -29,8 +31,8 @@ jobs:
2931
env:
3032
INPUT_VERSION: ${{ inputs.version }}
3133
run: |
32-
if ! printf '%s' "$INPUT_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([abprc.][0-9]+)*$'; then
33-
echo "::error::Invalid version '${INPUT_VERSION}'. Expected an explicit PEP 440 version (e.g. 0.1.0, 1.2.3b1). Bump keywords like 'patch' or 'major' are not accepted."
34+
if ! printf '%s' "$INPUT_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$'; then
35+
echo "::error::Invalid version '${INPUT_VERSION}'. Expected an explicit version like 0.1.0, 1.2.3rc1, or 1.2.3.post1. Bump keywords like 'patch' or 'major' are not accepted."
3436
exit 1
3537
fi
3638
sed -i "s/^version = \".*\"/version = \"${INPUT_VERSION}\"/" pyproject.toml

0 commit comments

Comments
 (0)