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

Improve This workflow is intentionally terminating early with a success code messaging for users #62

Open
Isengo1989 opened this issue Nov 21, 2023 · 11 comments
Milestone

Comments

@Isengo1989
Copy link

I did try the "Quick start" way but only get

Warning: This workflow is intentionally terminating early with a success code -- it has not checked for misspellings.
Notice: See `check-spelling` `pull_request_target` workflow (`.github/workflows/spelling.yml`) in PR #4. https://github.com/********/docs-test/pull/4/checks

Unsure what that means, but it would be helpful to have a min Setup file or more info of what is missing.

@jsoref
Copy link
Member

jsoref commented Nov 21, 2023

Do you have a public example repository?

Ideally the link it gave should be followable and yield a status for pull_request_target...

Here's my sample:

  1. I create a repository https://github.com/jsoref/check-spelling-issues-62 using the https://github.com/check-spelling/spell-check-this template repository

  2. I created a readme file jsoref/check-spelling-issues-62@e361aed

  3. I edited the readme jsoref/check-spelling-issues-62@94bd7cb, creating a branch https://github.com/jsoref/check-spelling-issues-62/tree/jsoref-patch-1, and a pull request quick jsoref/check-spelling-issues-62#1

  4. The push created a run:
    https://github.com/jsoref/check-spelling-issues-62/actions/runs/6948950821?pr=1
    which has the message you encountered: https://github.com/jsoref/check-spelling-issues-62/actions/runs/6948950821?pr=1#summary-18906040910

  5. The link takes me to https://github.com/jsoref/check-spelling-issues-62/pull/1/checks
    image

  6. If I click the event for the pull_request_target https://github.com/jsoref/check-spelling-issues-62/actions/runs/6948951406

  7. I get a run that has a report that's reasonably helpful: https://github.com/jsoref/check-spelling-issues-62/actions/runs/6948951406#summary-18906042437
    (There are two reports because both checking spelling and posting a comment trigger summary outputs)

@jsoref
Copy link
Member

jsoref commented Nov 21, 2023

Once I work through with you what I need to do to clarify this, I'll definitely work on improving the output.

I have a (ℹ️ how do I use this?) item for one case, so adding a similar item for this should be pretty easy, I just need to figure out what to put into it (and for that, I definitely need end user feedback, so thanks in advance).

@jsoref jsoref changed the title No error or hint Improve This workflow is intentionally terminating early with a success code messaging for users Nov 21, 2023
@jsoref
Copy link
Member

jsoref commented Feb 9, 2024

I've looked a bit more and think I can actually remove the message entirely: fd10e7a

@jsoref jsoref added this to the v0.0.23 milestone Feb 9, 2024
@GeorgeXCV
Copy link

Same, this repo makes no sense. I make a PR with the setup mentioned in docs, I have spelling mistakes in other file to test it and get the same message:
Warning: This workflow is intentionally terminating early with a success code -- it has not checked for misspellings.

@jsoref
Copy link
Member

jsoref commented Apr 2, 2024

@GeorgeXCV there should be a second message that hopefully has a link to another run that has the report. If you have a public repository, I can help out. The change described here will result in the message disappearing, but the behavior will be the same otherwise.

@GeorgeXCV
Copy link

GeorgeXCV commented Apr 3, 2024

@jsoref Its the same result, workflow skipped.
Screenshot 2024-04-03 at 12 08 24

@jsoref
Copy link
Member

jsoref commented Apr 3, 2024

So, here's a reworked version:

🏠 Summary

Annotations

1 notice
ℹ️ Workflow skipped
See check-spelling pull_request_target workflow (.github/workflows/spelling.yml) in PR #1. https://github.com/check-spelling-sandbox/check-spelling-actions-runs-links/actions/workflows/.github/workflows/spelling.yml?query=event:pull_request_target+branch:jsoref-patch-1 https://github.com/check-spelling-sandbox/check-spelling-actions-runs-links/pull/1/checks

Check Spelling summary

⏭️ Workflow skipped

See check-spelling pull_request_target workflow (.github/workflows/spelling.yml) in PR check-spelling-sandbox/check-spelling-actions-runs-links#1.

https://github.com/check-spelling-sandbox/check-spelling-actions-runs-links/pull/1/checks

With the improvements, hopefully people can get to the pieces they need. For the example above, that's one of:

@jsoref
Copy link
Member

jsoref commented Apr 3, 2024

@GeorgeXCV you're cropping the view which isn't helping, and you haven't provided a repository (which also doesn't help). My guess is that this is a private repository because I can't find a public repository that has a PR at the right space using this search: https://github.com/search?q=path%3A.github%2Fworkflows%2Fspell-checker.yml+%22uses%3A+check-spelling%2Fcheck-spelling%22+pull_request_target+%22Check+Spelling%22&type=code

The general idea that the flow here is trying to get you to follow is that there's a second check -- for "on: pull_request_target" that you should be able to see in the checks tab of your PR. A url to it would probably look something like: https://github.com/ REPO_OWNER / REPO_NAME /pull/744/checks (if it's GHES it might not start with https://github.com -- although no one has talked to me about running check-spelling on GHES so I don't know that it works).

@GeorgeXCV, can you:

  • Provide an uncropped screenshot of the report?
  • Provide a screenshot of the checks view for your pull request (try to limit how much cropping/censoring you do), it should ideally look something like this:
    Screenshot 2024-04-03 at 12 28 08 PM

@GeorgeXCV
Copy link

@jsoref Is no "pull_request_target", only "push":
Screenshot 2024-04-04 at 05 40 17
Screenshot 2024-04-04 at 05 39 28

@jsoref
Copy link
Member

jsoref commented Apr 4, 2024

@GeorgeXCV: thanks, I think I've figured out what's going on... your workflow has suppress_push_for_open_pull_request but it's missing on: pull_request(_target) -- can you please provide the workflow file from the run? (and where you got it from... I'm pretty sure that my documentation includes both events...)

@GeorgeXCV
Copy link

@GeorgeXCV: thanks, I think I've figured out what's going on... your workflow has suppress_push_for_open_pull_request but it's missing on: pull_request(_target) -- can you please provide the workflow file from the run? (and where you got it from... I'm pretty sure that my documentation includes both events...)

It was copied and pasted from the repo. I commented out a couple lines related to SARIF since don't have GitHub Advanced Security.

Workflow:

name: Check Spelling

# Comment management is handled through a secondary job, for details see:
# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions
#
# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment
#   (in odd cases, it might actually run just to collapse a comment, but that's fairly rare)
#   it needs `contents: write` in order to add a comment.
#
# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment
#   or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment)
#   it needs `pull-requests: write` in order to manipulate those comments.

# Updating pull request branches is managed via comment handling.
# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list
#
# These elements work together to make it happen:
#
# `on.issue_comment`
#   This event listens to comments by users asking to update the metadata.
#
# `jobs.update`
#   This job runs in response to an issue_comment and will push a new commit
#   to update the spelling metadata.
#
# `with.experimental_apply_changes_via_bot`
#   Tells the action to support and generate messages that enable it
#   to make a commit to update the spelling metadata.
#
# `with.ssh_key`
#   In order to trigger workflows when the commit is made, you can provide a
#   secret (typically, a write-enabled github deploy key).
#
#   For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key

# Sarif reporting
#
# Access to Sarif reports is generally restricted (by GitHub) to members of the repository.
#
# Requires enabling `security-events: write`
# and configuring the action with `use_sarif: 1`
#
#   For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Sarif-output

# Minimal workflow structure:
#
# on:
#   push:
#     ...
#   pull_request_target:
#     ...
# jobs:
#   # you only want the spelling job, all others should be omitted
#   spelling:
#     # remove `security-events: write` and `use_sarif: 1`
#     # remove `experimental_apply_changes_via_bot: 1`
#     ... otherwise adjust the `with:` as you wish

on:
  push:
    branches:
    - "**"
    tags-ignore:
    - "**"
  pull_request_target:
    branches:
    - "**"
    types:
    - 'opened'
    - 'reopened'
    - 'synchronize'
  issue_comment:
    types:
    - 'created'

jobs:
  spelling:
    name: Check Spelling
    permissions:
      contents: read
      pull-requests: read
      actions: read
    # Removed 'security-events: write' as we don't have GitHub Advanced Security
    outputs:
      followup: ${{ steps.spelling.outputs.followup }}
    runs-on: ubuntu-latest
    if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
    concurrency:
      group: spelling-${{ github.event.pull_request.number || github.ref }}
      # note: If you use only_check_changed_files, you do not want cancel-in-progress
      cancel-in-progress: true
    steps:
    - name: check-spelling
      id: spelling
      uses: check-spelling/check-spelling@main
      with:
        suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
        checkout: true
        check_file_names: 1
        spell_check_this: check-spelling/spell-check-this@prerelease
        post_comment: 0
        use_magic_file: 1
        report-timing: 1
        warnings: bad-regex,binary-file,deprecated-feature,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check
        experimental_apply_changes_via_bot: 1
        # Removed 'use_sarif: 1' to disable SARIF reporting
        extra_dictionary_limit: 20
        extra_dictionaries:
          cspell:software-terms/dict/softwareTerms.txt

  comment-push:
    name: Report (Push)
    # If your workflow isn't running on push, you can remove this job
    runs-on: ubuntu-latest
    needs: spelling
    permissions:
      contents: write
    if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
    steps:
    - name: comment
      uses: check-spelling/check-spelling@main
      with:
        checkout: true
        spell_check_this: check-spelling/spell-check-this@prerelease
        task: ${{ needs.spelling.outputs.followup }}

  comment-pr:
    name: Report (PR)
    # If you workflow isn't running on pull_request*, you can remove this job
    runs-on: ubuntu-latest
    needs: spelling
    permissions:
      contents: read
      pull-requests: write
    if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
    steps:
    - name: comment
      uses: check-spelling/check-spelling@main
      with:
        checkout: true
        spell_check_this: check-spelling/spell-check-this@prerelease
        task: ${{ needs.spelling.outputs.followup }}
        experimental_apply_changes_via_bot: 1

  update:
    name: Update PR
    permissions:
      contents: write
      pull-requests: write
      actions: read
    runs-on: ubuntu-latest
    if: ${{
        github.event_name == 'issue_comment' &&
        github.event.issue.pull_request &&
        contains(github.event.comment.body, '@check-spelling-bot apply')
      }}
    concurrency:
      group: spelling-update-${{ github.event.issue.number }}
      cancel-in-progress: false
    steps:
    - name: apply spelling updates
      uses: check-spelling/check-spelling@main
      with:
        experimental_apply_changes_via_bot: 1
        checkout: true
        ssh_key: "${{ secrets.CHECK_SPELLING }}"

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

3 participants