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

Tests fail when only one_of is provided #228

Closed
riker09 opened this issue Jul 6, 2021 · 7 comments
Closed

Tests fail when only one_of is provided #228

riker09 opened this issue Jul 6, 2021 · 7 comments

Comments

@riker09
Copy link

riker09 commented Jul 6, 2021

This action does not work when the PR is assigned a cicd label.

Here's the simplified workflow YAML: #227 (comment)

All tests are being run, this is the resulting log:

[...]
2021-07-06T06:29:08.0452411Z with:
2021-07-06T06:29:08.0452792Z   any_of: cicd
2021-07-06T06:29:08.0454423Z   repo_token: ***
2021-07-06T06:29:08.0454865Z ##[endgroup]
2021-07-06T06:29:08.0502532Z ##[command]/usr/bin/docker run --name ***REDACTED*** --label 8a33c1 --workdir /github/workspace --rm -e INPUT_ANY_OF -e INPUT_REPO_TOKEN -e INPUT_ONE_OF -e INPUT_NONE_OF -e INPUT_ALL_OF -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/***REDACTED***":"/github/workspace" ***REDACTED***
2021-07-06T06:29:08.4962745Z Checking GitHub labels ...
2021-07-06T06:29:08.6978831Z Label check successful: required none of , and found 0.
2021-07-06T06:29:08.6979653Z Label check successful: required any of cicd, and found 1: cicd
2021-07-06T06:29:08.6985999Z Error: Label check failed: required 1 of , but found 0.
2021-07-06T06:29:08.6986667Z Label check failed: required all of , but found 0.

From the looks of it I would say that even though I only passed one option (one_of) the other three tests are also evaluated with empty values. This looks like a bug to me and I would gladly help, but I don't know any Go.

Originally posted by @riker09 in #227 (comment)

@riker09
Copy link
Author

riker09 commented Jul 6, 2021

It works when I add all options (leave them non-empty):

    - id: check-label
      name: Check pull request labels
      uses: agilepathway/label-checker@v1.0.90
      continue-on-error: true
      with:
        any_of: cicd
        one_of: cicd
        all_of: cicd
        none_of: non-existing-label
        repo_token: ${{ secrets.GITHUB_TOKEN }}

@johnboyes
Copy link
Contributor

Hi @riker09, as per my comment in 227 really sorry that I'm only replying now. Thanks for raising this, will look into it and get back to you shortly.

@johnboyes
Copy link
Contributor

johnboyes commented Jul 18, 2021

Hi again @riker09, I've released a fix for this (v1.0.91). Thanks for reporting it, it was caused by me wrongly expecting the checks to be not present by default, whereas they actually default to an empty string. Please let me know if it fixes this issue, and also if #227 is still an issue after this fix. Thanks, John

@riker09
Copy link
Author

riker09 commented Jul 19, 2021

Hello @johnboyes and no worries for a "late" reply. Sometimes I receive responses for issues that I've commented years ago, so you are well within the socially accepted limit. 😀

I will check out the new version and report any results here as soon as I find the time. Vacation season is around the corner, though. If you don't hear from me then you know the reason behind it.

From a quick glance at your changes I'd say this should do the trick just fine.

@johnboyes
Copy link
Contributor

Hi @riker09, just following up on this to see if it did indeed fix your issue? No probs if vacation season is in full swing, no rush 🏖️ 😎

@riker09
Copy link
Author

riker09 commented Aug 5, 2021

It did! Thanks 😃

@johnboyes
Copy link
Contributor

Fixed by #230

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