diff --git a/conda_forge_webservices/github_actions_integration/__main__.py b/conda_forge_webservices/github_actions_integration/__main__.py index 231b69358..5eebdeab1 100644 --- a/conda_forge_webservices/github_actions_integration/__main__.py +++ b/conda_forge_webservices/github_actions_integration/__main__.py @@ -441,8 +441,9 @@ def main_finalize_task(task_data_dir): task_results["lint_error"] = True if task_results["lint_error"]: + run_link = get_gha_run_link() _message = dedent_with_escaped_continue( - """ + f""" Hi! This is the friendly automated conda-forge-linting service. I failed to even lint the recipe, probably because of a \\ @@ -451,13 +452,14 @@ def main_finalize_task(task_data_dir): though. To get a traceback to help figure out what's going on, \\ install conda-smithy and run \\ `conda smithy recipe-lint --conda-forge .` from the recipe \\ - directory. + directory. You can also examine the [workflow logs]({run_link}) \\ + for more detail. """ ) - run_link = get_gha_run_link() _message += ( "\n\nThis message was generated by " - f"GitHub actions workflow run [{run_link}]({run_link}).\n" + f"GitHub Actions workflow run [{run_link}]({run_link}). " + "Examine the logs at this URL for more detail.\n" ) msg = make_lint_comment(gh_repo, pr.number, _message) status = "bad" diff --git a/conda_forge_webservices/github_actions_integration/linting.py b/conda_forge_webservices/github_actions_integration/linting.py index 9b5f5c5aa..5ccb827db 100644 --- a/conda_forge_webservices/github_actions_integration/linting.py +++ b/conda_forge_webservices/github_actions_integration/linting.py @@ -1,7 +1,7 @@ import os import time -from .utils import dedent_with_escaped_continue +from .utils import dedent_with_escaped_continue, get_gha_run_link def get_recipes_for_linting(gh, repo, pr_id, lints, hints): @@ -108,7 +108,7 @@ def build_and_make_lint_comment(gh, repo, pr_id, lints, hints): have a merge conflict. Please try to merge or rebase with the base \\ branch to resolve this conflict. - Please ping the 'conda-forge/core' team (using the @ notation in a \\ + Please ping the 'conda-forge/core' team (using the `@` notation in a \\ comment) if you believe this is a bug. """, ) @@ -150,6 +150,8 @@ def build_and_make_lint_comment(gh, repo, pr_id, lints, hints): # Put the recipes in the form "```recipe/a```, ```recipe/b```". recipe_code_blocks = ", ".join(f"```{r}```" for r in linted_recipes) + run_link = get_gha_run_link() + good = dedent_with_escaped_continue( f""" Hi! This is the friendly automated conda-forge-linting service. @@ -170,6 +172,11 @@ def build_and_make_lint_comment(gh, repo, pr_id, lints, hints): """ ).format("\n".join(messages)) ) + mixed += ( + "\n\nThis message was generated by " + f"GitHub Actions workflow run [{run_link}]({run_link}). " + "Examine the logs at this URL for more detail.\n" + ) bad = dedent_with_escaped_continue( f""" @@ -183,6 +190,11 @@ def build_and_make_lint_comment(gh, repo, pr_id, lints, hints): {{}} """ ).format("\n".join(messages)) + bad += ( + "\n\nThis message was generated by " + f"GitHub Actions workflow run [{run_link}]({run_link}). " + "Examine the logs at this URL for more detail.\n" + ) if not all_recipes: message = dedent_with_escaped_continue( @@ -190,7 +202,7 @@ def build_and_make_lint_comment(gh, repo, pr_id, lints, hints): Hi! This is the friendly automated conda-forge-linting service. I was trying to look for recipes to lint for you, but couldn't find any. - Please ping the 'conda-forge/core' team (using the @ notation in a \\ + Please ping the 'conda-forge/core' team (using the `@` notation in a \\ comment) if you believe this is a bug. """, ) diff --git a/conda_forge_webservices/github_actions_integration/utils.py b/conda_forge_webservices/github_actions_integration/utils.py index 44e86c18c..7d9dd54fb 100644 --- a/conda_forge_webservices/github_actions_integration/utils.py +++ b/conda_forge_webservices/github_actions_integration/utils.py @@ -107,9 +107,10 @@ def comment_and_push_if_changed( Hi! This is the friendly automated conda-forge-webservice. I tried to {action} for you but ran into some issues. \\ - Please check the output logs of the GitHub actions workflow \\ - below for more details. You can also ping conda-forge/core \\ - for further assistance{help_message}. + Please check the [output logs]({run_link}) of the \\ + GitHub Actions workflow \\ + below for more details. You can also ping `conda-forge/core` \\ + (using the `@` notation) for further assistance{help_message}. """) else: message = dedent_with_escaped_continue(f""" @@ -134,7 +135,8 @@ def comment_and_push_if_changed( if run_link is not None: message += ( "\n\nThis message was generated by " - f"GitHub actions workflow run [{run_link}]({run_link}).\n" + f"GitHub Actions workflow run [{run_link}]({run_link}). " + "Examine the logs at this URL for more detail.\n" ) pull.create_issue_comment(message) diff --git a/conda_forge_webservices/linting.py b/conda_forge_webservices/linting.py index c3fc20f6c..476c4d80c 100644 --- a/conda_forge_webservices/linting.py +++ b/conda_forge_webservices/linting.py @@ -170,7 +170,7 @@ def lint_all_recipes(all_recipe_dir: Path, base_recipes: list[Path]) -> tuple[st Hi! This is the friendly automated conda-forge-linting service. I was trying to look for recipes to lint for you, but couldn't find any. - Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug. + Please ping the 'conda-forge/core' team (using the `@` notation in a comment) if you believe this is a bug. """) # noqa status = "no recipes" elif all_pass and hints_found: @@ -269,7 +269,7 @@ def compute_lint_message( I was trying to look for recipes to lint for you, but it appears we have a merge conflict. Please try to merge or rebase with the base branch to resolve this conflict. - Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug. + Please ping the 'conda-forge/core' team (using the `@` notation in a comment) if you believe this is a bug. """) # noqa status = "merge_conflict" diff --git a/conda_forge_webservices/tests/linting/test_compute_lint_message.py b/conda_forge_webservices/tests/linting/test_compute_lint_message.py index e333ef3a9..9b798b1c4 100644 --- a/conda_forge_webservices/tests/linting/test_compute_lint_message.py +++ b/conda_forge_webservices/tests/linting/test_compute_lint_message.py @@ -117,7 +117,7 @@ def test_conflict_ok_recipe(skip_if_linting_via_gha): I was trying to look for recipes to lint for you, but it appears we have a merge conflict. Please try to merge or rebase with the base branch to resolve this conflict. - Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug. + Please ping the 'conda-forge/core' team (using the `@` notation in a comment) if you believe this is a bug. """) # noqa lint = compute_lint_message( @@ -134,7 +134,7 @@ def test_conflict_2_ok_recipe(skip_if_linting_via_gha): I was trying to look for recipes to lint for you, but it appears we have a merge conflict. Please try to merge or rebase with the base branch to resolve this conflict. - Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug. + Please ping the 'conda-forge/core' team (using the `@` notation in a comment) if you believe this is a bug. """) # noqa lint = compute_lint_message( @@ -220,7 +220,7 @@ def test_no_recipe(skip_if_linting_via_gha): Hi! This is the friendly automated conda-forge-linting service. I was trying to look for recipes to lint for you, but couldn't find any. - Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug. + Please ping the 'conda-forge/core' team (using the `@` notation in a comment) if you believe this is a bug. """) # noqa lint = compute_lint_message( diff --git a/conda_forge_webservices/tokens.py b/conda_forge_webservices/tokens.py index bf6f144e6..57ae2184b 100644 --- a/conda_forge_webservices/tokens.py +++ b/conda_forge_webservices/tokens.py @@ -106,7 +106,7 @@ def generate_app_token_for_webservices_only(app_id, raw_pem): if "GITHUB_ACTIONS" in os.environ and os.environ["GITHUB_ACTIONS"] == "true": sys.stdout.flush() print( - "running in github actions", + "running in GitHub Actions", flush=True, ) print(f"::add-mask::{raw_pem}", flush=True) @@ -157,7 +157,7 @@ def generate_app_token_for_webservices_only(app_id, raw_pem): gh_token = integration.get_access_token(installation.id).token if "GITHUB_ACTIONS" in os.environ and os.environ["GITHUB_ACTIONS"] == "true": sys.stdout.flush() - print("made GITHUB token and masking it for github actions", flush=True) + print("made GITHUB token and masking it for GitHub Actions", flush=True) print(f"::add-mask::{gh_token}", flush=True) except Exception: @@ -350,7 +350,7 @@ def generate_app_token_for_feedstock(app_id, raw_pem, repo, readonly=False): if "GITHUB_ACTIONS" in os.environ and os.environ["GITHUB_ACTIONS"] == "true": sys.stdout.flush() print( - "running in github actions", + "running in GitHub Actions", flush=True, ) print(f"::add-mask::{raw_pem}", flush=True) @@ -417,7 +417,7 @@ def generate_app_token_for_feedstock(app_id, raw_pem, repo, readonly=False): if "GITHUB_ACTIONS" in os.environ and os.environ["GITHUB_ACTIONS"] == "true": sys.stdout.flush() - print("made GITHUB token and masking it for github actions", flush=True) + print("made GITHUB token and masking it for GitHub Actions", flush=True) print(f"::add-mask::{gh_token}", flush=True) except Exception: