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 skip-comment flag and input as well as coverage_report output #37

Merged
merged 6 commits into from
Jul 25, 2024

Conversation

jshufro
Copy link
Contributor

@jshufro jshufro commented Jul 17, 2024

Closes #34

An example of it working can be seen here Rocket-Rescue-Node/rescue-proxy#66 (comment)

scripts/github-action.sh Fixed Show fixed Hide fixed
Copy link
Owner

@fgrosse fgrosse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution 🙏

I left a couple of comments and will address them myself so we can merge this one quickly. I will test this a bit with one of my repos but plan to wait for your final OK as well so we know it works as expected on your end.

action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
scripts/github-action.sh Outdated Show resolved Hide resolved
scripts/github-action.sh Outdated Show resolved Hide resolved
@fgrosse
Copy link
Owner

fgrosse commented Jul 25, 2024

I just completed testing the feature via fgrosse/prioqueue#5 where I tried to emulate your use case of adding a prefix to the generated comment. This gives me the confidence to go ahead and merge the PR as it is right now.

In order to use this version in your workflow, you need to make sure, your Leave a comment with a link step treats the newlines from the output string correctly (i.e. keeps them in the string and does not interpolate them inside the javascript code itself). The following approach worked well in my tests:

      - name: Leave a comment with a link
        uses: actions/github-script@v6
        with:
          script: |
            const report = `${{ steps.report-step.outputs.coverage_report }}`;
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `[Coverage Report](${{ needs.unit_tests.outputs.html-coverage-url }})\n${report}`
            })

@fgrosse fgrosse merged commit 94f0113 into fgrosse:main Jul 25, 2024
6 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.

Support generating comment as an output instead of posting it directly
2 participants