File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import json
34import os
45import pathlib
56import typing
1718if typing .TYPE_CHECKING :
1819 from collections import abc
1920
21+ GITHUB_ACTIONS_OUTPUT_NAME = "scopes"
22+
2023
2124def match_scopes (
2225 files : abc .Iterable [str ],
@@ -57,9 +60,8 @@ def maybe_write_github_outputs(
5760 if not gha :
5861 return
5962 with pathlib .Path (gha ).open ("a" , encoding = "utf-8" ) as fh :
60- for key in sorted (all_scopes ):
61- val = "true" if key in scopes_hit else "false"
62- fh .write (f"{ key } ={ val } \n " )
63+ data = {key : key in scopes_hit for key in sorted (all_scopes )}
64+ fh .write (f"{ GITHUB_ACTIONS_OUTPUT_NAME } ={ json .dumps (data )} " )
6365
6466
6567class InvalidDetectedScopeError (exceptions .ScopesError ):
Original file line number Diff line number Diff line change @@ -289,9 +289,7 @@ def test_maybe_write_github_outputs(
289289 cli .maybe_write_github_outputs (all_scopes , scopes_hit )
290290
291291 content = output_file .read_text ()
292- assert "backend=true\n " in content
293- assert "docs=true\n " in content
294- assert "frontend=false\n " in content
292+ assert content == """scopes={"backend": true, "docs": true, "frontend": false}"""
295293
296294
297295def test_maybe_write_github_outputs_no_env (
You can’t perform that action at this time.
0 commit comments