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

skip news check if github.actor is pre-commit-ci[bot] #12614

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/news-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
fetch-depth: 0

- name: Check news entry
if: "!contains(github.event.pull_request.labels.*.name, 'skip news')"
if: |
!contains(github.event.pull_request.labels.*.name, 'skip news') ||
github.actor != 'pre-commit-ci[bot]'
Copy link
Member

@notatallshaw notatallshaw Dec 7, 2024

Choose a reason for hiding this comment

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

Is the logical OR here correct?

If the skip news label isn't present, the first condition in the if statement evaluates to True, if the github actor is pre-commit-ci[bot] then the second condition evaluates to False. True OR False is True, so the check will be required.

Further if the skip news label is present but the actor is not pre-commit-ci[bot], then this will be True or False which is True, and so skip news will now no longer work unless the actor is pre-commit-ci[bot].

I think the correct code here is:

if: |
  !(contains(github.event.pull_request.labels.*.name, 'skip news')) &&
  github.actor != 'pre-commit-ci[bot]'

But let me know if I missed something.

run: |
if ! pipx run towncrier check --compare-with origin/${{ github.base_ref }}; then
echo "Please see https://pip.pypa.io/dev/news-entry-failure for guidance."
Expand Down
1 change: 1 addition & 0 deletions news/12605.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skip news check if ``github.actor`` is ``pre-commit-ci[bot]``
Loading