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

Output a Markdown result directly for custom integrations #154

Open
jeremylvln opened this issue Feb 21, 2023 · 1 comment
Open

Output a Markdown result directly for custom integrations #154

jeremylvln opened this issue Feb 21, 2023 · 1 comment

Comments

@jeremylvln
Copy link

Hi!

To integrate this action into a tight feedback loop with my devs, I wanted to have a comment on each PR containing the latest run of this action, like a lot of tools do (Codecov, SonarCloud, Vercel, ...). I cannot do that today because this action only allows me to post a comment on each commit which is really not a good DX IMO.

The issue here is that this action does not provide any way of retrieving the Markdown text it would put in the commit comments. More, considering the Job Summary PR, it is using another textual representation of the results.

It would be really great to have a common Markdown representation of the results: the code will be simpler because only one code to rule them all, and anybody wanting to create a custom integration could re-use it directly. This can be done through a custom temporary file containing the Markdown, or an action output directly.

The create-or-update-comment action by Peter Evans enables to do it with custom content very easily, we could end with something like:

    - name: Compute benchmark results
      uses: benchmark-action/github-action-benchmark@v1
      id: benchmark
      with:
        tool: 'benchmarkjs'
        output-file-path: output.txt
        external-data-json-path: ./cache/benchmark-data.json
        name: Benchmark.js Benchmark
        github-token: ${{ secrets.GITHUB_TOKEN }}
        fail-on-alert: true

    - name: Find Comment
      uses: peter-evans/find-comment@v2
      id: fc
      with:
        issue-number: ${{ github.event.pull_request.number }}
        comment-author: 'github-actions[bot]'
        body-includes: Performance Alert

    - name: Create or update comment
      uses: peter-evans/create-or-update-comment@v2
      with:
        comment-id: ${{ steps.fc.outputs.comment-id }}
        issue-number: ${{ github.event.pull_request.number }}
        body: ${{ steps.benchmark.outputs.markdown-results }}
        edit-mode: replace
@ktrz
Copy link
Member

ktrz commented Mar 25, 2024

Hi @jeremylvln
I'm working on this issue which should probably resolve your use case. However, I think having a common markdown representation and add it to the output of the action would be beneficial for other integrations. I'm putting this on my todo list :)

BTW: in PR #159 I've unified the commit comment and the job summary output. The one difference is that in commit comment it wraps the detailed info in an expandable section to limit the visual load of the comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants