Skip to content

Commit 2d068b2

Browse files
Updated reusable caller permissions/secrets and hardened Taskfile sync/version validation
1 parent 631c428 commit 2d068b2

5 files changed

Lines changed: 24 additions & 18 deletions

File tree

.github/workflows/auto-create-pull-request.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ jobs:
1717
uses: devops-infra/.github/.github/workflows/reusable-auto-create-pull-request.yml@v1
1818
with:
1919
profile: actions
20-
secrets:
21-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
20+
secrets: inherit

.github/workflows/cron-check-dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ permissions:
99
contents: read
1010
issues: write
1111
pull-requests: read
12+
packages: write
1213

1314
jobs:
1415
call:
1516
uses: devops-infra/.github/.github/workflows/reusable-cron-check-dependencies.yml@v1
1617
with:
1718
profile: actions
18-
secrets:
19-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
19+
secrets: inherit

.github/workflows/manual-sync-common-files.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ jobs:
2424
with:
2525
sync-type: ${{ inputs.type }}
2626
template-profile: actions
27+
secrets: inherit

.github/workflows/manual-update-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ on:
2626
permissions:
2727
contents: write
2828
packages: write
29+
pull-requests: write
2930

3031
jobs:
3132
call:
@@ -35,5 +36,4 @@ jobs:
3536
explicit-version: ${{ inputs.version }}
3637
build-and-push-only: ${{ inputs.build_only }}
3738
profile: actions
38-
secrets:
39-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
39+
secrets: inherit

Taskfile.cicd.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ tasks:
103103
echo "❌ ERROR: VERSION is empty"
104104
exit 1
105105
fi
106+
if ! echo "{{.VERSION}}" | grep -Eq '^v?[0-9]+\.[0-9]+\.[0-9]+$'; then
107+
echo "❌ ERROR: VERSION '{{.VERSION}}' is not a valid semantic version (expected vX.Y.Z or X.Y.Z)"
108+
exit 1
109+
fi
106110
- echo Updating full version from {{.VERSION_FROM_ACTION_YML}} to {{.VERSION}}
107111
- echo Updating minor version from {{.MINOR_FROM_ACTION_YML}} to {{.VERSION_MINOR}}
108112
- echo Updating major version from {{.MAJOR_FROM_ACTION_YML}} to {{.VERSION_MAJOR}}
@@ -159,7 +163,9 @@ tasks:
159163
[ -n "$current" ] || { echo "Current version not found or invalid. Expected vX.Y.Z"; exit 1; }
160164
current="$(normalize_version "$current")" || { echo "Current version not found or invalid. Expected vX.Y.Z"; exit 1; }
161165
no_v="${current#v}"
162-
IFS='.' read -r major minor patch <<< "$no_v"
166+
major="$(printf "%s" "$no_v" | awk -F. '{print $1}')"
167+
minor="$(printf "%s" "$no_v" | awk -F. '{print $2}')"
168+
patch="$(printf "%s" "$no_v" | awk -F. '{print $3}')"
163169
case "$bump_type" in
164170
patch) next="v${major}.${minor}.$((patch + 1))" ;;
165171
minor) next="v${major}.$((minor + 1)).0" ;;
@@ -270,11 +276,11 @@ tasks:
270276
cmds:
271277
- |
272278
echo "▶️ Syncing configuration files from devops-infra/.github..."
273-
curl -sL {{.CONFIGS_BASE_URL}}/.editorconfig -o ./.editorconfig
274-
curl -sL {{.CONFIGS_BASE_URL}}/.hadolint.yaml -o ./.hadolint.yaml
275-
curl -sL {{.CONFIGS_BASE_URL}}/.pre-commit-config.yaml -o ./.pre-commit-config.yaml
276-
curl -sL {{.CONFIGS_BASE_URL}}/.shellcheckrc -o ./.shellcheckrc
277-
curl -sL {{.CONFIGS_BASE_URL}}/.yamllint.yml -o ./.yamllint.yml
279+
curl -fsSL {{.CONFIGS_BASE_URL}}/.editorconfig -o ./.editorconfig
280+
curl -fsSL {{.CONFIGS_BASE_URL}}/.hadolint.yaml -o ./.hadolint.yaml
281+
curl -fsSL {{.CONFIGS_BASE_URL}}/.pre-commit-config.yaml -o ./.pre-commit-config.yaml
282+
curl -fsSL {{.CONFIGS_BASE_URL}}/.shellcheckrc -o ./.shellcheckrc
283+
curl -fsSL {{.CONFIGS_BASE_URL}}/.yamllint.yml -o ./.yamllint.yml
278284
git add .editorconfig .hadolint.yaml .pre-commit-config.yaml .shellcheckrc .yamllint.yml
279285
echo "✅ Synced configuration files"
280286
@@ -283,8 +289,8 @@ tasks:
283289
cmds:
284290
- |
285291
echo "▶️ Syncing ignore files from devops-infra/.github..."
286-
curl -sL {{.CONFIGS_BASE_URL}}/.gitignore -o ./.gitignore
287-
curl -sL {{.CONFIGS_BASE_URL}}/.dockerignore -o ./.dockerignore
292+
curl -fsSL {{.CONFIGS_BASE_URL}}/.gitignore -o ./.gitignore
293+
curl -fsSL {{.CONFIGS_BASE_URL}}/.dockerignore -o ./.dockerignore
288294
git add .gitignore .dockerignore
289295
echo "✅ Synced ignore files"
290296
@@ -293,9 +299,9 @@ tasks:
293299
cmds:
294300
- |
295301
echo "▶️ Syncing Taskfiles from devops-infra/.github..."
296-
curl -sL {{.TASKFILES_BASE_URL}}/Taskfile.yml -o ./Taskfile.yml
297-
curl -sL {{.TASKFILES_BASE_URL}}/Taskfile.cicd.yml -o ./Taskfile.cicd.yml
298-
curl -sL {{.TASKFILES_BASE_URL}}/Taskfile.docker.yml -o ./Taskfile.docker.yml
299-
curl -sL {{.TASKFILES_BASE_URL}}/Taskfile.variables.yml -o ./Taskfile.variables.yml
302+
curl -fsSL {{.TASKFILES_BASE_URL}}/Taskfile.yml -o ./Taskfile.yml
303+
curl -fsSL {{.TASKFILES_BASE_URL}}/Taskfile.cicd.yml -o ./Taskfile.cicd.yml
304+
curl -fsSL {{.TASKFILES_BASE_URL}}/Taskfile.docker.yml -o ./Taskfile.docker.yml
305+
curl -fsSL {{.TASKFILES_BASE_URL}}/Taskfile.variables.yml -o ./Taskfile.variables.yml
300306
git add Taskfile*.yml
301307
echo "✅ Synced Taskfiles"

0 commit comments

Comments
 (0)