Skip to content

Commit 9682996

Browse files
committed
Skip IAM policies that look like they've already been updated.
1 parent 105b2a6 commit 9682996

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

aws_doc_sdk_examples_tools/agent/make_prompts.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
from aws_doc_sdk_examples_tools.doc_gen import DocGen, Snippet
99

10+
DEFAULT_METADATA_PREFIX = "[DEFAULT]"
11+
12+
1013
# Setup logging
1114
logging.basicConfig(level=logging.INFO)
1215
logger = logging.getLogger(__name__)
@@ -23,16 +26,23 @@ def write_prompts(doc_gen: DocGen, out_dir: Path, language: str) -> None:
2326
examples = doc_gen.examples
2427
snippets = doc_gen.snippets
2528
for example_id, example in examples.items():
26-
prompt_path = out_dir / f"{example_id}.md"
27-
snippet_key = (
28-
example.languages[language]
29-
.versions[0]
30-
.excerpts[0]
31-
.snippet_files[0]
32-
.replace("/", ".")
33-
)
34-
snippet = snippets[snippet_key]
35-
prompt_path.write_text(snippet.code, encoding="utf-8")
29+
# "Title" and "Abbrev" are the defaults. If they're not there, it suggests we've already
30+
# added new titles.
31+
title = example.title or ""
32+
title_abbrev = example.title_abbrev or ""
33+
if title.startswith(DEFAULT_METADATA_PREFIX) and title_abbrev.startswith(
34+
DEFAULT_METADATA_PREFIX
35+
):
36+
prompt_path = out_dir / f"{example_id}.md"
37+
snippet_key = (
38+
example.languages[language]
39+
.versions[0]
40+
.excerpts[0]
41+
.snippet_files[0]
42+
.replace("/", ".")
43+
)
44+
snippet = snippets[snippet_key]
45+
prompt_path.write_text(snippet.code, encoding="utf-8")
3646

3747

3848
def setup_ailly(system_prompts: List[str], out_dir: Path) -> None:

0 commit comments

Comments
 (0)