You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/08/29 13:53:40 UTC
(tooling-actions) branch main updated: Add zizmor to lints and fix detected problems
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-actions.git
The following commit(s) were added to refs/heads/main by this push:
new 9de949d Add zizmor to lints and fix detected problems
9de949d is described below
commit 9de949d6b62d1ce818c5149f5f7ed8bd3ca2636c
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Aug 29 14:53:20 2025 +0100
Add zizmor to lints and fix detected problems
---
.pre-commit-config.yaml | 7 +++++++
.yamllint.yaml | 1 +
upload-to-atr/action.yml | 40 ++++++++++++++++++++++++++++------------
3 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 63757ef..f408435 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,3 +1,4 @@
+---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -69,3 +70,9 @@ repos:
- id: check-github-actions
files: ^(.*/)?action\.ya?ml$
args: ["--verbose"]
+
+ - repo: https://github.com/woodruffw/zizmor-pre-commit
+ rev: v1.11.0
+ hooks:
+ - id: zizmor
+ args: [--min-severity, low]
diff --git a/.yamllint.yaml b/.yamllint.yaml
index 62d295b..f40c9a7 100644
--- a/.yamllint.yaml
+++ b/.yamllint.yaml
@@ -1,3 +1,4 @@
+---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
diff --git a/upload-to-atr/action.yml b/upload-to-atr/action.yml
index 28e4be2..0d7007d 100644
--- a/upload-to-atr/action.yml
+++ b/upload-to-atr/action.yml
@@ -1,3 +1,4 @@
+---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -27,44 +28,59 @@ inputs:
audience: {description: "OIDC audience", default: "atr-test"}
atr-host: {description: "ATR host", default: "release-test.apache.org"}
ssh-port: {description: "SSH port", default: "2222"}
- rsync-args: {description: "Arguments for rsync", default: "-av"}
runs:
using: "composite"
steps:
- name: Create a GitHub OIDC JWT
+ id: create-github-jwt
shell: bash
run: |
set -euxo pipefail
- url="${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${{ inputs.audience }}"
+ url="${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${INPUTS_AUDIENCE}"
jwt="$(curl -sS -H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" "$url" \
| python3 -c 'import json, sys; print(json.load(sys.stdin)["value"])')"
echo "::add-mask::$jwt"
- echo "JWT=$jwt" >> "$GITHUB_ENV"
+ echo "jwt=$jwt" >> "$GITHUB_OUTPUT"
+ env:
+ INPUTS_AUDIENCE: ${{ inputs.audience }}
- name: Generate an ephemeral SSH key
+ id: generate-ssh-key
shell: bash
run: |
set -euxo pipefail
ssh-keygen -t ed25519 -N "" -f "$RUNNER_TEMP/ssh_key"
- echo "SSH_PRIVATE_KEY_PATH=$RUNNER_TEMP/ssh_key" >> "$GITHUB_ENV"
- echo "SSH_PUBLIC_KEY=$(cat "$RUNNER_TEMP/ssh_key.pub")" >> "$GITHUB_ENV"
+ echo "ssh_private_key_path=$RUNNER_TEMP/ssh_key" >> "$GITHUB_OUTPUT"
+ echo "ssh_public_key=$(cat "$RUNNER_TEMP/ssh_key.pub")" >> "$GITHUB_OUTPUT"
- name: Register the ephemeral SSH key with ATR
shell: bash
run: |
set -euxo pipefail
- curl -sS -X POST -H "Content-Type: application/json" \
- -d "{\"jwt\":\"$JWT\",\"ssh_key\":\"$SSH_PUBLIC_KEY\"}" \
- "https://${{ inputs.atr-host }}/api/jwt/github"
+ jq -n --arg jwt "$JWT" --arg key "$SSH_PUBLIC_KEY" '{jwt:$jwt, ssh_key:$key}' |
+ curl -sS -X POST -H 'Content-Type: application/json' \
+ -d @- "https://${INPUTS_ATR_HOST}/api/jwt/github"
+ env:
+ INPUTS_ATR_HOST: ${{ inputs.atr-host }}
+ JWT: ${{ steps.create-github-jwt.outputs.jwt }}
+ SSH_PUBLIC_KEY: ${{ steps.generate-ssh-key.outputs.ssh_public_key }}
- name: Upload to ATR using rsync
shell: bash
run: |
set -euxo pipefail
command -v rsync > /dev/null || { sudo apt-get update -y && sudo apt-get install -y rsync; }
- src="${{ inputs.src }}"
+ src="${INPUTS_SRC}"
case "$src" in */) ;; *) src="$src/";; esac
- rsync ${{ inputs.rsync-args }} \
- -e "ssh -p ${{ inputs.ssh-port }} -i $SSH_PRIVATE_KEY_PATH -o StrictHostKeyChecking=accept-new" \
- "$src" "${{ inputs.asf-uid }}@${{ inputs.atr-host }}:/${{ inputs.project }}/${{ inputs.version }}/"
+ rsync -av \
+ -e "ssh -p ${INPUTS_SSH_PORT} -i $SSH_PRIVATE_KEY_PATH -o StrictHostKeyChecking=accept-new" \
+ "$src" "${INPUTS_ASF_UID}@${INPUTS_ATR_HOST}:/${INPUTS_PROJECT}/${INPUTS_VERSION}/"
+ env:
+ INPUTS_SRC: ${{ inputs.src }}
+ INPUTS_SSH_PORT: ${{ inputs.ssh-port }}
+ INPUTS_ASF_UID: ${{ inputs.asf-uid }}
+ INPUTS_ATR_HOST: ${{ inputs.atr-host }}
+ INPUTS_PROJECT: ${{ inputs.project }}
+ INPUTS_VERSION: ${{ inputs.version }}
+ SSH_PRIVATE_KEY_PATH: ${{ steps.generate-ssh-key.outputs.ssh_private_key_path }}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org