Skip to content

Commit 416b079

Browse files
authored
Fix release issue workflow (#79268)
Remove the `--phab-token` argument (which currently eats the subsequent "auto" as the token no longer exists) and related code. I think this will fix the workflow failure in #79253 (comment).
1 parent 4a58284 commit 416b079

File tree

2 files changed

+0
-93
lines changed

2 files changed

+0
-93
lines changed

.github/workflows/issue-release-workflow.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
6262
release-workflow \
6363
--issue-number ${{ github.event.issue.number }} \
64-
--phab-token ${{ secrets.RELEASE_WORKFLOW_PHAB_TOKEN }} \
6564
auto
6665
6766
create-pull-request:
@@ -90,5 +89,4 @@ jobs:
9089
--token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
9190
release-workflow \
9291
--issue-number ${{ github.event.issue.number }} \
93-
--phab-token ${{ secrets.RELEASE_WORKFLOW_PHAB_TOKEN }} \
9492
auto

llvm/utils/git/github-automation.py

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -251,85 +251,6 @@ def setup_llvmbot_git(git_dir="."):
251251
config.set_value("user", "email", "[email protected]")
252252

253253

254-
def phab_api_call(phab_token: str, url: str, args: dict) -> dict:
255-
"""
256-
Make an API call to the Phabricator web service and return a dictionary
257-
containing the json response.
258-
"""
259-
data = {"api.token": phab_token}
260-
data.update(args)
261-
response = requests.post(url, data=data)
262-
return response.json()
263-
264-
265-
def phab_login_to_github_login(
266-
phab_token: str, repo: github.Repository.Repository, phab_login: str
267-
) -> Optional[str]:
268-
"""
269-
Tries to translate a Phabricator login to a github login by
270-
finding a commit made in Phabricator's Differential.
271-
The commit's SHA1 is then looked up in the github repo and
272-
the committer's login associated with that commit is returned.
273-
274-
:param str phab_token: The Conduit API token to use for communication with Pabricator
275-
:param github.Repository.Repository repo: The github repo to use when looking for the SHA1 found in Differential
276-
:param str phab_login: The Phabricator login to be translated.
277-
"""
278-
279-
args = {
280-
"constraints[authors][0]": phab_login,
281-
# PHID for "LLVM Github Monorepo" repository
282-
"constraints[repositories][0]": "PHID-REPO-f4scjekhnkmh7qilxlcy",
283-
"limit": 1,
284-
}
285-
# API documentation: https://reviews.llvm.org/conduit/method/diffusion.commit.search/
286-
r = phab_api_call(
287-
phab_token, "https://reviews.llvm.org/api/diffusion.commit.search", args
288-
)
289-
data = r["result"]["data"]
290-
if len(data) == 0:
291-
# Can't find any commits associated with this user
292-
return None
293-
294-
commit_sha = data[0]["fields"]["identifier"]
295-
committer = repo.get_commit(commit_sha).committer
296-
if not committer:
297-
# This committer had an email address GitHub could not recognize, so
298-
# it can't link the user to a GitHub account.
299-
print(f"Warning: Can't find github account for {phab_login}")
300-
return None
301-
return committer.login
302-
303-
304-
def phab_get_commit_approvers(phab_token: str, commit: github.Commit.Commit) -> list:
305-
args = {"corpus": commit.commit.message}
306-
# API documentation: https://reviews.llvm.org/conduit/method/differential.parsecommitmessage/
307-
r = phab_api_call(
308-
phab_token, "https://reviews.llvm.org/api/differential.parsecommitmessage", args
309-
)
310-
review_id = r["result"]["revisionIDFieldInfo"]["value"]
311-
if not review_id:
312-
# No Phabricator revision for this commit
313-
return []
314-
315-
args = {"constraints[ids][0]": review_id, "attachments[reviewers]": True}
316-
# API documentation: https://reviews.llvm.org/conduit/method/differential.revision.search/
317-
r = phab_api_call(
318-
phab_token, "https://reviews.llvm.org/api/differential.revision.search", args
319-
)
320-
reviewers = r["result"]["data"][0]["attachments"]["reviewers"]["reviewers"]
321-
accepted = []
322-
for reviewer in reviewers:
323-
if reviewer["status"] != "accepted":
324-
continue
325-
phid = reviewer["reviewerPHID"]
326-
args = {"constraints[phids][0]": phid}
327-
# API documentation: https://reviews.llvm.org/conduit/method/user.search/
328-
r = phab_api_call(phab_token, "https://reviews.llvm.org/api/user.search", args)
329-
accepted.append(r["result"]["data"][0]["fields"]["username"])
330-
return accepted
331-
332-
333254
def extract_commit_hash(arg: str):
334255
"""
335256
Extract the commit hash from the argument passed to /action github
@@ -364,7 +285,6 @@ def __init__(
364285
branch_repo_name: str,
365286
branch_repo_token: str,
366287
llvm_project_dir: str,
367-
phab_token: str,
368288
) -> None:
369289
self._token = token
370290
self._repo_name = repo
@@ -375,7 +295,6 @@ def __init__(
375295
else:
376296
self._branch_repo_token = self.token
377297
self._llvm_project_dir = llvm_project_dir
378-
self._phab_token = phab_token
379298

380299
@property
381300
def token(self) -> str:
@@ -401,10 +320,6 @@ def branch_repo_token(self) -> str:
401320
def llvm_project_dir(self) -> str:
402321
return self._llvm_project_dir
403322

404-
@property
405-
def phab_token(self) -> str:
406-
return self._phab_token
407-
408323
@property
409324
def repo(self) -> github.Repository.Repository:
410325
return github.Github(self.token).get_repo(self.repo_name)
@@ -708,11 +623,6 @@ def execute_command(self) -> bool:
708623
release_workflow_parser.add_argument(
709624
"--issue-number", type=int, required=True, help="The issue number to update"
710625
)
711-
release_workflow_parser.add_argument(
712-
"--phab-token",
713-
type=str,
714-
help="Phabricator conduit API token. See https://reviews.llvm.org/settings/user/<USER>/page/apitokens/",
715-
)
716626
release_workflow_parser.add_argument(
717627
"--branch-repo-token",
718628
type=str,
@@ -759,7 +669,6 @@ def execute_command(self) -> bool:
759669
args.branch_repo,
760670
args.branch_repo_token,
761671
args.llvm_project_dir,
762-
args.phab_token,
763672
)
764673
if not release_workflow.release_branch_for_issue:
765674
release_workflow.issue_notify_no_milestone(sys.stdin.readlines())

0 commit comments

Comments
 (0)