diff --git a/edx_repo_tools/pull_request_creator/__init__.py b/edx_repo_tools/pull_request_creator/__init__.py index d9e9d281..3a115666 100644 --- a/edx_repo_tools/pull_request_creator/__init__.py +++ b/edx_repo_tools/pull_request_creator/__init__.py @@ -617,9 +617,16 @@ def _create_new_pull_request(self): pr.number, ) if self.output_pr_url_for_github_action: - # using print rather than logger to avoid the logger - # prepending anything past which github actions wouldn't parse - print(f'generated_pr=https://github.com/{self.repository.full_name}/pull/{pr.number} >> $GITHUB_OUTPUT') + # need to append to the special file that GitHub actions exposes + # as using print here won't set the output, it simply logs the message + github_output_path = os.environ.get("GITHUB_OUTPUT") + if not github_output_path: + logger.warning("GITHUB_OUTPUT not set, failed to write action output.") + else: + with open(github_output_path, "a", encoding="utf-8") as out_file: + out_file.write( + f"generated_pr=https://github.com/{self.repository.full_name}/pull/{pr.number}\n" + ) def delete_old_pull_requests(self): logger.info("Checking if there's any old pull requests to delete")