You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jedcunningham (via GitHub)" <gi...@apache.org> on 2023/06/08 16:08:11 UTC

[GitHub] [airflow] jedcunningham commented on a diff in pull request #31792: Fix re-running failed jobs by committers without rebase

jedcunningham commented on code in PR #31792:
URL: https://github.com/apache/airflow/pull/31792#discussion_r1223266981


##########
dev/breeze/src/airflow_breeze/utils/selective_checks.py:
##########
@@ -776,7 +778,21 @@ def runs_on(self) -> str:
         if self._github_repository == APACHE_AIRFLOW_GITHUB_REPOSITORY:
             if self._github_event in [GithubEvents.SCHEDULE, GithubEvents.PUSH]:
                 return RUNS_ON_SELF_HOSTED_RUNNER
-            if self._github_actor in COMMITTERS and USE_PUBLIC_RUNNERS_LABEL not in self._pr_labels:
+            actor = self._github_actor
+            if self._github_event in (GithubEvents.PULL_REQUEST, GithubEvents.PULL_REQUEST_TARGET):
+                try:
+                    actor = self._github_context_dict["event"]["pull_request"]["user"]["login"]
+                    get_console().print(
+                        f"[warning]The {actor} retrieved as actor from GITHUB_CONTEXT's"
+                        f" event.pull_request.user.login[/]"
+                    )
+                except Exception as e:
+                    get_console().print(f"[warning]Exception when reading user login: {e}[/]")
+                    get_console().print(
+                        f"[info]Could not find the actor from pull request, "
+                        f"falling back to the actor who triggered the PR {actor}:[/]"

Review Comment:
   ```suggestion
                           f"falling back to the actor who triggered the PR: {actor}[/]"
   ```
   
   Maybe?



##########
dev/breeze/src/airflow_breeze/utils/selective_checks.py:
##########
@@ -776,7 +778,21 @@ def runs_on(self) -> str:
         if self._github_repository == APACHE_AIRFLOW_GITHUB_REPOSITORY:
             if self._github_event in [GithubEvents.SCHEDULE, GithubEvents.PUSH]:
                 return RUNS_ON_SELF_HOSTED_RUNNER
-            if self._github_actor in COMMITTERS and USE_PUBLIC_RUNNERS_LABEL not in self._pr_labels:
+            actor = self._github_actor
+            if self._github_event in (GithubEvents.PULL_REQUEST, GithubEvents.PULL_REQUEST_TARGET):
+                try:
+                    actor = self._github_context_dict["event"]["pull_request"]["user"]["login"]
+                    get_console().print(
+                        f"[warning]The {actor} retrieved as actor from GITHUB_CONTEXT's"

Review Comment:
   ```suggestion
                           f"[info]{actor} retrieved as actor from GITHUB_CONTEXT's"
   ```
   
   2 things:
   
   - Don't need "the" here, even if "The potiuk retrieved as actor" does sounds good :)
   - Shouldn't this be an info, not warning?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org