Adds validation for required keys in endpoint and request nodes#147
Conversation
|
Hmmm the Changelog Reminder job is failing because it has no permissions, since it is a fork. Also, the other checks are not running, like the one that run the tests. @barbosa do you know how other projects handle forks and CI automations like this one? I am going to investigate it. |
|
Closes #64 |
camilamaia
left a comment
There was a problem hiding this comment.
Really great PR 🤩 Just one minor suggestion
|
|
||
|
|
||
| def validate_required_keys(keys, required_keys, scope): | ||
| if not set(required_keys) <= set(keys): |
There was a problem hiding this comment.
@gillianomenezes ahá! You are using sets ❤️ Perfect use case!
|
|
||
| def validate_required_keys(keys, required_keys, scope): | ||
| if not set(required_keys) <= set(keys): | ||
| missing_keys = list(set(required_keys) - set(keys)) |
There was a problem hiding this comment.
| missing_keys = list(set(required_keys) - set(keys)) | |
| missing_keys = set(required_keys) - set(keys) |
What do you think of send a set instance to MissingMandatoryKeyError init instead of a list, avoiding this casting?
", ".join(sorted(missing_keys)) works fine for sets too!
There was a problem hiding this comment.
I didn't know that. I'll update. Thank you!
@camilamaia apparently this is a known issue: peterjgrainger/action-changelog-reminder#28 Not from the action itself but a GitHub Action's limitation at the moment. The best we can do right now is to simply ignore it for fork PRs until this is fixed. uses: peterjgrainger/action-changelog-reminder@v1.2.0
+ if: github.repository == 'scanapi/scanapi'
with:
changelog_regex: "CHANGELOG.md"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}more: actions/labeler#12 |
|
@camilamaia I have just bumped into this:
https://help.github.com/en/actions/reference/events-that-trigger-workflows |
Wow, this is super tricky. Thanks for bringing it. Next PR from a fork we can ask the person to enable it then... This was the only thing i could come up with |
Adds required keys to request and endpoint nodes.