diff --git a/.github/workflows/schedule-deployment.yml b/.github/workflows/schedule-deployment.yml index 93f88f6..f78d1ef 100644 --- a/.github/workflows/schedule-deployment.yml +++ b/.github/workflows/schedule-deployment.yml @@ -75,6 +75,7 @@ jobs: - name: Append JSONL to file env: SCHEDULE: ${{ steps.verify-inputs.outputs.schedule }} + JOB_ID: ${{ github.run_number }} run: python3 .github/workflows/scripts/schedule_matchkeys.py -l info - name: Show recent schedule diff --git a/.github/workflows/scripts/schedule_matchkeys.py b/.github/workflows/scripts/schedule_matchkeys.py index 946a5ba..9e793a4 100755 --- a/.github/workflows/scripts/schedule_matchkeys.py +++ b/.github/workflows/scripts/schedule_matchkeys.py @@ -14,7 +14,7 @@ from pathlib import Path import sys -SCRIPT_VERSION = "1.0.1" +SCRIPT_VERSION = "1.0.2" LOGLEVELS = { "debug": logging.DEBUG, @@ -54,17 +54,23 @@ def get_options(): except KeyError: LOGGER.error("Missing env: SCHEDULE") options_okay = False + try: + job_id = os.environ["JOB_ID"] + except KeyError: + LOGGER.error("Missing env: JOB_ID") + options_okay = False schedule_pn = PROG_PATH.parent.parent.parent.joinpath("js/schedule-matchkeys.jsonl") if not options_okay: sys.exit(2) - return schedule, schedule_pn + return int(job_id), schedule, schedule_pn -def append_schedule(schedule, schedule_pn): +def append_schedule(job_id, schedule, schedule_pn): """ Composes the JSONL and appends to file. """ json_packet = {} + json_packet["id"] = job_id json_packet["scheduleDate"] = ( datetime.now(timezone.utc).replace(microsecond=0).isoformat() ) @@ -78,9 +84,9 @@ def main(): """ Append the schedule JSONL to schedule-matchkeys.jsonl file. """ - schedule, schedule_pn = get_options() + job_id, schedule, schedule_pn = get_options() LOGGER.debug("schedule=%s schedule_pn=%s", schedule, schedule_pn) - append_schedule(schedule, schedule_pn) + append_schedule(job_id, schedule, schedule_pn) if __name__ == "__main__": diff --git a/js/schedule-matchkeys.jsonl b/js/schedule-matchkeys.jsonl index 9e5c2f6..ca3c752 100644 --- a/js/schedule-matchkeys.jsonl +++ b/js/schedule-matchkeys.jsonl @@ -1,2 +1 @@ -{"scheduleDate": "2026-07-28T07:33:40+00:00", "deployment": "goldrush2024:1163910:main,isxn:d88522c:main"} -{"scheduleDate": "2026-07-28T07:36:44+00:00", "deployment": "goldrush2024:5d8c6eb:main"} +{"id": 16, "scheduleDate": "2026-08-10T00:19:07+00:00", "deployment": "goldrush2024:1163910:remotes/origin/main,isxn:d88522c:remotes/origin/main"}