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

Commit Status with manual workflow #605

Open
sebastien-savalle opened this issue Jun 7, 2024 · 1 comment
Open

Commit Status with manual workflow #605

sebastien-savalle opened this issue Jun 7, 2024 · 1 comment

Comments

@sebastien-savalle
Copy link

sebastien-savalle commented Jun 7, 2024

Hello,

First of all, thanks a lot for publishing this github action which is really useful.
This works like a charm with pull request event, but I found a small issue when using manual workflow. In such case, the comment is correctly published to the PRs related to the selected branch, but the commit status is missing.

As a workaround (see below example), I retrieve the step outcome of your action and post it manually.
Would it be possible to also support commit status for manual workflow ?

Thanks a lot,
Sebastien

- name: Publish report
  id: internal_api_report
  uses: EnricoMi/publish-unit-test-result-action@v2
  if: always()
  with:
    files: |
      !packages/api-tests/**/node_modules/**
      ./packages/api-tests/reports/internal-api.xml
    check_name: "Internal API Tests Result"
    action_fail: true
    action_fail_on_inconclusive: true
- name: Set Internal API Commit Status
  uses: actions/github-script@v7
  if: always()
  env:
    GITHUB_TOKEN: ${{ github.token }}
    RESULT_STATE: ${{ steps.internal_api_report.outcome }}
  with:
    script: |
      github.rest.repos.createCommitStatus({
        owner: context.repo.owner,
        repo: context.repo.repo,
        sha: context.sha,
        state: process.env.RESULT_STATE,
        description: process.env.RESULT_STATE,
        context: 'internal-api'
      })
@EnricoMi
Copy link
Owner

Can you provide an example commit / workflow run in a public repo?

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

No branches or pull requests

2 participants