Skip to content

Commit

Permalink
Merge pull request #695 from conda-forge/enable-for-tests
Browse files Browse the repository at this point in the history
feat: enable new linting and rerendering for testing
  • Loading branch information
beckermr authored Sep 30, 2024
2 parents 589a098 + e684b23 commit 5894d6c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
29 changes: 24 additions & 5 deletions conda_forge_webservices/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import time
import shutil
import tempfile
import textwrap
from ruamel.yaml import YAML
import requests
from requests.exceptions import RequestException
import logging

# from .utils import tmp_directory
import conda_forge_webservices
from .linting import (
compute_lint_message,
comment_on_pr,
Expand All @@ -27,7 +29,6 @@
inject_app_token_into_feedstock,
inject_app_token_into_feedstock_readonly,
)
import textwrap

LOGGER = logging.getLogger("conda_forge_webservices.commands")
NUM_GIT_CLONE_TRIES = 10
Expand Down Expand Up @@ -983,10 +984,28 @@ def rerender(full_name, pr_num):
inject_app_token_into_feedstock(full_name, repo=repo)
inject_app_token_into_feedstock_readonly(full_name, repo=repo)

return not repo.create_repository_dispatch(
"rerender",
client_payload={"pr": pr_num},
)
_, repo_name = full_name.split("/")
if repo_name == "cf-autotick-bot-test-package-feedstock":
ref = conda_forge_webservices.__version__.replace("+", ".")
workflow = gh.get_repo("conda-forge/conda-forge-webservices").get_workflow(
"webservices-workflow-dispatch.yml"
)
running = workflow.create_dispatch(
ref=ref,
inputs={
"task": "rerender",
"repo": repo_name,
"pr_number": str(pr_num),
"container_tag": ref,
},
)
else:
running = repo.create_repository_dispatch(
"rerender",
client_payload={"pr": pr_num},
)

return not running


def update_version(full_name, pr_num, input_ver):
Expand Down
24 changes: 20 additions & 4 deletions conda_forge_webservices/linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from git import GitCommandError, Repo
import conda_smithy.lint_recipe

import conda_forge_webservices
from conda_forge_webservices.tokens import get_gh_client

LOGGER = logging.getLogger("conda_forge_webservices.linting")
Expand Down Expand Up @@ -40,10 +41,25 @@ def lint_via_github_actions(full_name: str, pr_num: int) -> bool:
if should_skip:
return False

running = repo.create_repository_dispatch(
"lint",
client_payload={"pr": pr_num},
)
if repo_name == "cf-autotick-bot-test-package-feedstock":
ref = conda_forge_webservices.__version__.replace("+", ".")
workflow = gh.get_repo("conda-forge/conda-forge-webservices").get_workflow(
"webservices-workflow-dispatch.yml"
)
running = workflow.create_dispatch(
ref=ref,
inputs={
"task": "lint",
"repo": repo_name,
"pr_number": str(pr_num),
"container_tag": ref,
},
)
else:
running = repo.create_repository_dispatch(
"lint",
client_payload={"pr": pr_num},
)

if running:
_set_pr_status(repo_owner, repo_name, sha, "pending")
Expand Down

0 comments on commit 5894d6c

Please sign in to comment.