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

feat: add github gist publisher #222

Merged
merged 10 commits into from
Aug 7, 2024

Conversation

anasmuhmd
Copy link
Contributor

@anasmuhmd anasmuhmd commented Jul 26, 2024

closes #134

@anasmuhmd anasmuhmd force-pushed the feat/github-gist-publisher branch from 8a1e6db to 29889fe Compare July 27, 2024 13:31
@anasmuhmd anasmuhmd force-pushed the feat/github-gist-publisher branch from 9f76780 to d79c195 Compare July 28, 2024 10:23
@dobarx
Copy link
Contributor

dobarx commented Jul 29, 2024

Looks good, just found one weird issue. When gist_id is provided, renaming a filename or changing format results with having old and new file on same gist.

@anasmuhmd
Copy link
Contributor Author

Looks good, just found one weird issue. When gist_id is provided, renaming a filename or changing format results with having old and new file on same gist.

You're right. Files within a gist are identified by their names. If name changes, it's going to be treated a different file. I guess we can read the gist before update and mark the old file for deletion. I'll update. Thanks

@anasmuhmd
Copy link
Contributor Author

anasmuhmd commented Jul 29, 2024

Looks good, just found one weird issue. When gist_id is provided, renaming a filename or changing format results with having old and new file on same gist.

@dobarx Updated here: 976a51f

@anasmuhmd anasmuhmd force-pushed the feat/github-gist-publisher branch from 6b82be6 to 976a51f Compare July 29, 2024 18:12
@traut traut requested review from dobarx and Andrew-Morozko July 31, 2024 07:39
if !ok {
return
}
documentName := metaMap.(plugin.MapData)["name"]
Copy link
Member

@traut traut Jul 31, 2024

Choose a reason for hiding this comment

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

This is the wrong name to use - the name in the meta block is the template's name, not the document name. We should use the name of the document block (I think it is available in the document map?) -- "example" in the snippet above. Document name should always be present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@traut document name wasn't available in params. added it now: 22cba2a

Copy link
Contributor

@Andrew-Morozko Andrew-Morozko left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your contribution

Secret: true,
},
},
Args: dataspec.ObjectSpec{
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps you can add some constraints/default values? This helps with our documentation generation (not yet done for publishers, but would be in future) and allows you to skip repetetive calls like checks for Nulls in your code

Copy link
Contributor Author

@anasmuhmd anasmuhmd Aug 3, 2024

Choose a reason for hiding this comment

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

@Andrew-Morozko As mentioned in the issue here #134, these arguments are optional. so non null constraint doesn't make sense?. We can add a default for make_public. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

},
}
// overrides params if defined
descriptionAttr := params.Args.GetAttr("description")
Copy link
Contributor

Choose a reason for hiding this comment

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

For example, making description constraint.NonNull and cty.StringVal("") by default can simplify the code below

anasmuhmd and others added 3 commits August 3, 2024 11:45
@anasmuhmd anasmuhmd force-pushed the feat/github-gist-publisher branch from 3c490f6 to d600083 Compare August 3, 2024 07:57
@anasmuhmd anasmuhmd requested a review from traut August 4, 2024 15:42
@traut traut merged commit 31607be into blackstork-io:main Aug 7, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

publish.github_gist publisher in github plugin
4 participants