Skip to content

Fix/commenter #1258

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

Merged
merged 6 commits into from
Jul 7, 2022
Merged

Fix/commenter #1258

merged 6 commits into from
Jul 7, 2022

Conversation

germa89
Copy link
Collaborator

@germa89 germa89 commented Jul 7, 2022

I discover in #1155 that the commenter wasn't working.

Close #1155

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2022

Please add one of the following labels to add this contribution to the Release Notes 👇

@germa89
Copy link
Collaborator Author

germa89 commented Jul 7, 2022

Solution

The reason was the if evaluation. We had:

if: toJSON(github.event.pull_request.labels.*.name) == '{}'

But it should be:

if: toJSON(github.event.pull_request.labels.*.name) == '[]'

Tests

I did a test in:
5aef9cc

with:

    - name: Test
      run: |
        toJSON(github.event.pull_request.labels.*.name)
        ${{ toJSON(github.event.pull_request.labels.*.name) }}

and the result was:

https://github.com/pyansys/pymapdl/runs/7229660105?check_suite_focus=true

Notes

Pinging @jorgepiloto for review and for awareness.
Pinging @RobPasMue because it is good piece of info (evaluation of info in Github tends to return lists (square brackets))

@germa89 germa89 requested a review from jorgepiloto July 7, 2022 08:37
@germa89 germa89 self-assigned this Jul 7, 2022
@germa89 germa89 added BUG CI/CD Related with CICD, Github Actions, etc labels Jul 7, 2022
@germa89 germa89 added this to the v0.62.2 milestone Jul 7, 2022
@codecov
Copy link

codecov bot commented Jul 7, 2022

Codecov Report

Merging #1258 (dbedd16) into main (6498dff) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1258   +/-   ##
=======================================
  Coverage   78.02%   78.02%           
=======================================
  Files          43       43           
  Lines        6780     6780           
=======================================
  Hits         5290     5290           
  Misses       1490     1490           

@RobPasMue
Copy link
Member

RobPasMue commented Jul 7, 2022

Ha... Thanks for the update! I think it makes sense that it returns a list rather than brackets... YAML files work with lists. Plus, brackets are used for interpreting variables in the GitHub workflow... which makes sense that you would try to avoid and return a bracketed string.

JSON also works with square brackets for representing lists. In fact, what it must be happening is that all this information is (behind the scenes) a complete JSON file, and you must be accessing elements by calling github.event.pull_request.labels.*.name which will return the value for a key. By placing the asterisk in the call, you are forcing all the values to be represented in a list. And a JSON list is also in square brackets so, it just makes sense :)

Thanks for the info @germa89!! =)

@germa89
Copy link
Collaborator Author

germa89 commented Jul 7, 2022

Ha... Thanks for the update! I think it makes sense that it returns a list rather than brackets... YAML files work with lists. Plus, brackets are used for interpreting variables in the GitHub workflow... which makes sense that you would try to avoid and return a bracketed string.

JSON also works with square brackets for representing lists. In fact, what it must be happening is that all this information is (behind the scenes) a complete JSON file, and you must be accessing elements by calling github.event.pull_request.labels.*.name which will return the value for a key. By placing the asterisk in the call, you are forcing all the values to be represented in a list. And a JSON list is also in square brackets so, it just makes sense :)

Masterclass over here! This should be in the Github docs. 😄

@akaszynski akaszynski merged commit 2f0203a into main Jul 7, 2022
@akaszynski akaszynski deleted the fix/commenter branch July 7, 2022 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD Related with CICD, Github Actions, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PR labeler commenter does not work
3 participants