Skip to content

Commit

Permalink
If there's a {{ pr-build-summary }} in the PR description, update i…
Browse files Browse the repository at this point in the history
…t. (#1971)

* If there's a `{{ pr-build-summary }}`  in the PR description, update it.

* Add comment to the PR template

* Add pull-requests permission to pr_summary job
  • Loading branch information
jleibs authored Apr 26, 2023
1 parent 8f03908 commit 95891e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ To get an auto-generated PR description you can put "copilot:summary" or "copilo
### Checklist
* [ ] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [ ] I've included a screenshot or gif (if applicable)

<!-- This line will get updated when the PR build summary job finishes. -->
PR Build Summary: {{ pr-build-summary }}
1 change: 1 addition & 0 deletions .github/workflows/reusable_pr_summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
permissions:
contents: "read"
id-token: "write"
pull-requests: "write"

runs-on: ubuntu-latest

Expand Down
5 changes: 5 additions & 0 deletions scripts/generate_pr_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def generate_pr_summary(github_token: str, github_repository: str, pr_number: in
print("Uploading results to {}".format(upload_blob.name))
upload_blob.upload_from_file(buffer, content_type="text/html")

# If there's a {{ pr-build-summary }} string in the PR description, replace it with a link to the summary page.
pr_description = pull.body
new_description = pr_description.replace("{{ pr-build-summary }}", f"https://build.rerun.io/pr/{pr_number}")
pull.edit(body=new_description)


def main() -> None:
parser = argparse.ArgumentParser(description="Generate a PR summary page")
Expand Down

0 comments on commit 95891e4

Please sign in to comment.