Skip to content

Commit e50bff6

Browse files
committed
Deduplicate claim ref lookup
1 parent decbc9a commit e50bff6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

oidc-exchange.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,13 @@ def warn_on_reusable_workflow(claims: dict[str, typing.Any]) -> None:
222222
# A reusable workflow is identified by having different values
223223
# for its workflow_ref (the initiating workflow) and job_workflow_ref
224224
# (the reusable workflow).
225-
if claims.get('workflow_ref') == claims.get('job_workflow_ref'):
225+
workflow_ref = claims.get('workflow_ref')
226+
job_workflow_ref = claims.get('job_workflow_ref')
227+
228+
if workflow_ref == job_workflow_ref:
226229
return
227230

228-
warn(
229-
_REUSABLE_WORKFLOW_WARNING.format(
230-
job_workflow_ref=claims.get('job_workflow_ref'),
231-
workflow_ref=claims.get('workflow_ref'),
232-
),
233-
)
231+
warn(_REUSABLE_WORKFLOW_WARNING.format_map(locals()))
234232

235233

236234
def event_is_third_party_pr() -> bool:

0 commit comments

Comments
 (0)