3131_HERE = Path (__file__ ).parent .resolve ()
3232_TEMPLATES = _HERE / "templates"
3333
34- _SUMMARY = Path (os .getenv ("GITHUB_STEP_SUMMARY" )).open ("a" )
34+ _summary_path = os .getenv ("GITHUB_STEP_SUMMARY" )
35+ assert _summary_path is not None
36+ _SUMMARY = Path (_summary_path ).open ("a" )
37+
3538_RENDER_SUMMARY = os .getenv ("GHA_SIGSTORE_PYTHON_SUMMARY" , "true" ) == "true"
3639_DEBUG = os .getenv ("GHA_SIGSTORE_PYTHON_INTERNAL_BE_CAREFUL_DEBUG" , "false" ) != "false"
3740
@@ -117,49 +120,49 @@ def _fatal_help(msg):
117120 sigstore_python_env ["SIGSTORE_LOGLEVEL" ] = "DEBUG"
118121
119122identity_token = os .getenv ("GHA_SIGSTORE_PYTHON_IDENTITY_TOKEN" )
120- if identity_token != "" :
123+ if identity_token :
121124 sigstore_sign_args .extend (["--identity-token" , identity_token ])
122125
123126client_id = os .getenv ("GHA_SIGSTORE_PYTHON_OIDC_CLIENT_ID" )
124- if client_id != "" :
127+ if client_id :
125128 sigstore_sign_args .extend (["--oidc-client-id" , client_id ])
126129
127130client_secret = os .getenv ("GHA_SIGSTORE_PYTHON_OIDC_CLIENT_SECRET" )
128- if client_secret != "" :
131+ if client_secret :
129132 sigstore_sign_args .extend (["--oidc-client-secret" , client_secret ])
130133
131134signature = os .getenv ("GHA_SIGSTORE_PYTHON_SIGNATURE" )
132- if signature != "" :
135+ if signature :
133136 sigstore_sign_args .extend (["--signature" , signature ])
134137 sigstore_verify_args .extend (["--signature" , signature ])
135138 signing_artifact_paths .append (signature )
136139
137140certificate = os .getenv ("GHA_SIGSTORE_PYTHON_CERTIFICATE" )
138- if certificate != "" :
141+ if certificate :
139142 sigstore_sign_args .extend (["--certificate" , certificate ])
140143 sigstore_verify_args .extend (["--certificate" , certificate ])
141144 signing_artifact_paths .append (certificate )
142145
143146bundle = os .getenv ("GHA_SIGSTORE_PYTHON_BUNDLE" )
144- if bundle != "" :
147+ if bundle :
145148 sigstore_sign_args .extend (["--bundle" , bundle ])
146149 sigstore_verify_args .extend (["--bundle" , bundle ])
147150 signing_artifact_paths .append (bundle )
148151
149152fulcio_url = os .getenv ("GHA_SIGSTORE_PYTHON_FULCIO_URL" )
150- if fulcio_url != "" :
153+ if fulcio_url :
151154 sigstore_sign_args .extend (["--fulcio-url" , fulcio_url ])
152155
153156rekor_url = os .getenv ("GHA_SIGSTORE_PYTHON_REKOR_URL" )
154- if rekor_url != "" :
157+ if rekor_url :
155158 sigstore_global_args .extend (["--rekor-url" , rekor_url ])
156159
157160ctfe = os .getenv ("GHA_SIGSTORE_PYTHON_CTFE" )
158- if ctfe != "" :
161+ if ctfe :
159162 sigstore_sign_args .extend (["--ctfe" , ctfe ])
160163
161164rekor_root_pubkey = os .getenv ("GHA_SIGSTORE_PYTHON_REKOR_ROOT_PUBKEY" )
162- if rekor_root_pubkey != "" :
165+ if rekor_root_pubkey :
163166 sigstore_global_args .extend (["--rekor-root-pubkey" , rekor_root_pubkey ])
164167
165168if os .getenv ("GHA_SIGSTORE_PYTHON_STAGING" , "false" ) != "false" :
@@ -170,15 +173,15 @@ def _fatal_help(msg):
170173 _fatal_help ("verify-cert-identity must be specified when verify is enabled" )
171174elif not enable_verify and verify_cert_identity :
172175 _fatal_help ("verify-cert-identity cannot be specified without verify: true" )
173- else :
176+ elif verify_cert_identity :
174177 sigstore_verify_args .extend (["--cert-identity" , verify_cert_identity ])
175178
176179verify_oidc_issuer = os .getenv ("GHA_SIGSTORE_PYTHON_VERIFY_OIDC_ISSUER" )
177180if enable_verify and not verify_oidc_issuer :
178181 _fatal_help ("verify-oidc-issuer must be specified when verify is enabled" )
179182elif not enable_verify and verify_oidc_issuer :
180183 _fatal_help ("verify-oidc-issuer cannot be specified without verify: true" )
181- else :
184+ elif verify_oidc_issuer :
182185 sigstore_verify_args .extend (["--cert-oidc-issuer" , verify_oidc_issuer ])
183186
184187if os .getenv ("GHA_SIGSTORE_PYTHON_RELEASE_SIGNING_ARTIFACTS" ) == "true" :
@@ -211,8 +214,8 @@ def _fatal_help(msg):
211214 if "--bundle" not in sigstore_sign_args :
212215 signing_artifact_paths .append (f"{ file_ } .sigstore" )
213216
214- sigstore_sign_args .extend (files )
215- sigstore_verify_args .extend (files )
217+ sigstore_sign_args .extend ([ str ( f ) for f in files ] )
218+ sigstore_verify_args .extend ([ str ( f ) for f in files ] )
216219
217220_debug (f"signing: sigstore-python { [str (a ) for a in sigstore_sign_args ]} " )
218221
@@ -273,7 +276,9 @@ def _fatal_help(msg):
273276#
274277# In GitHub Actions, environment variables can be made to persist across
275278# workflow steps by appending to the file at `GITHUB_ENV`.
276- with Path (os .getenv ("GITHUB_ENV" )).open ("a" ) as gh_env :
279+ _github_env = os .getenv ("GITHUB_ENV" )
280+ assert _github_env is not None
281+ with Path (_github_env ).open ("a" ) as gh_env :
277282 # Multiline values must match the following syntax:
278283 #
279284 # {name}<<{delimiter}
0 commit comments