Skip to content

Commit 493de50

Browse files
committed
last one
1 parent 36aa6d3 commit 493de50

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ runs:
9898
- name: Mark the Autodoc Run as completed
9999
env:
100100
PYTHONPATH: ${{ github.action_path }}
101+
AUTODOC_RUN_ID: ${{ github.autodoc_run_id }}
101102
run: |
102103
python ${{ github.action_path }}/scripts/mark_run_completed.py \
103104
--server-address ${{ inputs.runllm_server_address }} \
104105
--api-key ${{ inputs.runllm_api_key }} \
105-
--run-id ${{ github.run_id }} \
106106
--pr-url ${{ steps.create_pr.outputs.pull-request-url }}
107107
shell: bash

scripts/generate_docs.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def update_docs(
8686
mode: AutodocOutputMode,
8787
diff_by_file_path: Dict[str, str],
8888
openapi_spec: Optional[str],
89-
) -> None:
89+
) -> int:
9090
"""Update the documentation for the given files in the diff.
9191
9292
NOTE: For OpenAPI mode, we currently expect to only be processing a single inut file right now.
@@ -167,6 +167,7 @@ def update_docs(
167167
raise
168168

169169
print(f"Total completion tokens: {total_token_count}, Cost: ${calculate_cost(total_token_count):.2f}")
170+
return run_id
170171

171172

172173
# Command line argument parsing
@@ -222,10 +223,14 @@ def update_docs(
222223
raise Exception("Only 'openapi' mode is currently supported!.")
223224

224225
client = RunLLMClient(args.server_address, args.api_key)
225-
update_docs(
226+
run_id = update_docs(
226227
client,
227228
gh_action_url,
228229
mode,
229230
diff_by_file_name,
230231
args.output_openapi_file,
231-
)
232+
)
233+
234+
# Track the Autodoc Run ID for subsequent GH action steps.
235+
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
236+
env_file.write(f"AUTODOC_RUN_ID={run_id}\n")

scripts/mark_run_completed.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import argparse
2+
import os
23

34
from scripts.client import RunLLMClient
45

56
parser = argparse.ArgumentParser(description="Mark an autodoc run as completed.")
67
parser.add_argument("--server-address", type=str, required=True, help="The address of the RunLLM server")
78
parser.add_argument("--api-key", type=str, required=True, help="The API key to use for the RunLLM server")
8-
parser.add_argument("--run-id", type=str, required=True, help="The GH action run id")
99
parser.add_argument("--pr-url", type=str, required=True, help="The URL of the pull request")
1010
args = parser.parse_args()
1111

1212
if __name__ == "__main__":
13+
run_id = os.environ.get("AUTODOC_RUN_ID")
14+
assert run_id
15+
1316
client = RunLLMClient(args.server_address, args.api_key)
14-
client.mark_completed(args.run_id, args.pr_url)
17+
client.mark_completed(run_id, args.pr_url)

0 commit comments

Comments
 (0)