Skip to content

Commit

Permalink
Merge pull request #83 from ZedThree/fix-split-post-metadata
Browse files Browse the repository at this point in the history
Always use PR number for split post workflow from uploaded metadata
  • Loading branch information
ZedThree committed Apr 18, 2023
2 parents 3d82fe5 + 202e94e commit 9b71ee9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions post/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ inputs:
workflow_id:
description: 'ID of the review workflow'
default: ${{ github.event.workflow_run.id }}
pr_number:
description: 'PR number of the review workflow'
default: ${{ github.event.workflow_run.pull_requests[0].number }}
outputs:
total_comments:
description: 'Total number of warnings from clang-tidy'
Expand All @@ -41,5 +38,4 @@ runs:
- --max-comments=${{ inputs.max_comments }}
- --lgtm-comment-body='${{ inputs.lgtm_comment_body }}'
- --workflow_id=${{ inputs.workflow_id }}
- --pr_number=${{ inputs.pr_number }}
- --annotations=${{ inputs.annotations }}
12 changes: 2 additions & 10 deletions post/clang_tidy_review/clang_tidy_review/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ def main():
type=bool_argument,
default=False,
)
parser.add_argument("--pr_number", help="PR number", default=None)

args = parser.parse_args()

pull_request = PullRequest(args.repo, args.pr_number, args.token)
pull_request = PullRequest(args.repo, None, args.token)

# Try to read the review artifacts if they're already present
metadata = load_metadata()
Expand All @@ -71,14 +70,7 @@ def main():
if metadata is None:
raise RuntimeError("Couldn't find review metadata")

if args.pr_number is not None and int(args.pr_number) != int(metadata["pr_number"]):
raise RuntimeError(
f"Conflicting PR numbers: Action was passed #{args.pr_number} "
f"and metadata from previous run has #{metadata['pr_number']}"
)

if args.pr_number is None:
pull_request.pr_number = metadata["pr_number"]
pull_request.pr_number = metadata["pr_number"]

print(
"clang-tidy-review generated the following review",
Expand Down

0 comments on commit 9b71ee9

Please sign in to comment.