Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a comment to the PR triggered Benchmark workflow #17

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

skyleaworlder
Copy link
Collaborator

@skyleaworlder skyleaworlder commented Jul 8, 2023

PR Checklist

  • Tests are added
  • Documentation, if applicable

Description

I'll temporarily NOT merge this PR, for I need some time to validate its feasibility.

In this PR, I introduced two new inputs, repository and pr_id, which are both the parameters of peter-evans/create-or-update-comment.

The new comment here is also posted by GitHub Actions.

image

And it was added by this run:

image
jobs:
  benchmark:
    runs-on: ubuntu-latest
    steps:
      -
        run: |
          echo "# Hello World!" > report.md
      -
        name: Upload report
        uses: actions/upload-artifact@v2
        with:
          name: report.md
          path: report.md
  Comment:
    needs: [benchmark]
    runs-on: ubuntu-latest
    steps:
      -
        name: Download report
        uses: actions/download-artifact@v3
        with:
          name: report.md
      -
        name: Comment
        uses: peter-evans/create-or-update-comment@v2
        with:
          issue-number: ${{ github.event.inputs.pr_id }}
          repository: ${{ github.event.inputs.repository }}
          token: ${{ secrets.PAT }}
          body-file: report.md

@skyleaworlder
Copy link
Collaborator Author

This feature requires a PAT (Personal Access Token) generated by a maintainer, and this PAT requires at least "read and write" access to "pull_request", which means the "comment" action can access all the objects (e.g. labels, assignees, especially comments) and then add a new comment to the target PR.

image

@skyleaworlder
Copy link
Collaborator Author

Merge this for new PRs.

@skyleaworlder skyleaworlder merged commit 1358f3c into FluxML:main Jul 19, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant