Skip to content

Add repo secret example using libsodium - #1626

Merged
gmlewis merged 17 commits into
google:masterfrom
raboley:add-new-repo-secret-example
Sep 12, 2020
Merged

gmlewis merged 17 commits into
google:masterfrom
raboley:add-new-repo-secret-example

Conversation

@raboley

@raboley raboley commented Sep 3, 2020

Copy link
Copy Markdown
Contributor

Added a new Example using libsodium to create a new secret in a github repo for use in github actions.

It is usable as a cli package to produce a secret in a given repo that the user owns.

usage is
main creates a new secret in github for a given owner/repo based on a secretName passed in as an arg
and a github token, and secret value provided via the environment

usage:
export GITHUB_AUTH_TOKEN=
export SECRET_VARIABLE=
go run main.go -owner -repo SECRET_VARIABLE

ex:
export GITHUB_AUTH_TOKEN=0000000000000000
export SECRET_VARIABLE="my-secret"
go run main.go -owner google -repo go-github SECRET_VARIABLE

Once it runs go to the github repository > settings > left side options bar > Secrets
And you should see the new secret appear there.

…b repo for use in github actions.

It is usable as a cli package to produce a secret in a given repo that the user owns.

usage is
main creates a new secret in github for a given owner/repo based on a secretName passed in as an arg
and a github token, and secret value provided via the environment

usage:
	export GITHUB_AUTH_TOKEN=<auth token from github that has secret create rights>
	export SECRET_VARIABLE=<secret value of the secret variable>
	go run main.go -owner <owner name> -repo <repository name> SECRET_VARIABLE

ex:
	export GITHUB_AUTH_TOKEN=0000000000000000
	export SECRET_VARIABLE="my-secret"
	go run main.go -owner google -repo go-github SECRET_VARIABLE

Once it runs go to the github repository > settings > left side options bar > Secrets
And you should see the new secret appear there.
@google-cla google-cla Bot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Sep 3, 2020
@codecov

codecov Bot commented Sep 3, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #1626 into master will increase coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1626      +/-   ##
==========================================
+ Coverage   68.04%   68.09%   +0.05%     
==========================================
  Files          97       97              
  Lines        8830     8863      +33     
==========================================
+ Hits         6008     6035      +27     
- Misses       1908     1912       +4     
- Partials      914      916       +2     
Impacted Files Coverage Δ
github/apps.go 62.50% <0.00%> (ø)
github/repos.go 70.04% <0.00%> (ø)
github/messages.go 81.17% <0.00%> (ø)
github/event_types.go 100.00% <0.00%> (ø)
github/repos_contents.go 62.33% <0.00%> (ø)
github/github.go 90.02% <0.00%> (+0.08%) ⬆️
github/event.go 94.33% <0.00%> (+0.10%) ⬆️
github/repos_commits.go 65.00% <0.00%> (+0.64%) ⬆️
github/actions_workflows.go 66.12% <0.00%> (+5.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00ac78b...5f3fb96. Read the comment docs.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @raboley. This is a good start, but let's please clean it up a bit. This may take a few iterations.

Comment thread example/newreposecret/main.go
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go
@gmlewis gmlewis changed the title fixes #1607 Add an example to add a repo secret using libsodium Add repo secret example using libsodium Sep 4, 2020
@raboley

raboley commented Sep 4, 2020

Copy link
Copy Markdown
Contributor Author

Thank you, @raboley. This is a good start, but let's please clean it up a bit. This may take a few iterations.

This is all really great @gmlewis thank you so much for the feedback I have updated based on your comments!

Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

more later...

Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm interrupted again, but I'm noticing that your sentences all need to be fully formed ending with periods for the resulting auto-generated go-docs.

I'm going to hold off on further reviewing this PR until some more updates are made so that gives you a chance to catch up. Thanks.

Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
raboley and others added 10 commits September 4, 2020 12:14
In Go, if two or more successive arguments to a method all have the same type, you can combine them together (which is the recommended idiomatic Go style), so:

func a(b int, c int, d int, e int, h string, i string j string) {}
becomes:

func a(b, c, d, e int, h, i, j string) {}
@raboley

raboley commented Sep 4, 2020

Copy link
Copy Markdown
Contributor Author

I updated based on all the latest comments, but I will take another look over all the prose to ensure it is punctuated, spelled and cased correctly.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @raboley ... this is looking great!
Just a couple more minor tweaks, please... then we should be ready for a second review and merging.

Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
Comment thread example/newreposecret/main.go Outdated
raboley and others added 4 commits September 6, 2020 09:12
@raboley

raboley commented Sep 6, 2020

Copy link
Copy Markdown
Contributor Author

Thank you, @raboley ... this is looking great!
Just a couple more minor tweaks, please... then we should be ready for a second review and merging.

Thank you again so much for the thoughtful edits @gmlewis! I had my wife (a teacher and much better writer than I) help me rewrite some of my comments to be full sentences that are more clear. I don't believe I have any sentence fragments or missing punctuation! I also made the other update around simplifying the if statement.

commit hash of the comment rewrites: 1bc4e4c

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Apart from the one comment, this now LGTM.
Please remove the redundant sentence, then we will be ready for a second LGTM and merging.

Thank you, @raboley !

Comment thread example/newreposecret/main.go Outdated
@raboley

raboley commented Sep 6, 2020

Copy link
Copy Markdown
Contributor Author

@wesleimp Pleased to meet you! Let me know of any improvements I can make and I will try to do so as speedily as possible!

@raboley

raboley commented Sep 12, 2020

Copy link
Copy Markdown
Contributor Author

@wesleimp let me know if there is anything I can do to help in your code review! Thank you again for taking the time and I hope everything is going well with you.

@wesleimp wesleimp left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @raboley
LGTM 👌🏼

Sorry for my late, my time is so limited on these days. 😬

@raboley

raboley commented Sep 12, 2020

Copy link
Copy Markdown
Contributor Author

Thank you!! 😄

@raboley

raboley commented Sep 12, 2020

Copy link
Copy Markdown
Contributor Author

Totally understand @wesleimp I really appreciate you taking the time! I know it is in short supply for us all! Is there anything else I need to do prior to this being merged or are we at the end?

@wesleimp

Copy link
Copy Markdown
Collaborator

@raboley we are at the end. Unfortunately I don't have permission to merge PRs.

Ping @gmlewis :)

@gmlewis

gmlewis commented Sep 12, 2020

Copy link
Copy Markdown
Collaborator

Successfully pinged. 😂
Thank you, @raboley and @wesleimp !
Merging.

@gmlewis
gmlewis merged commit dea2127 into google:master Sep 12, 2020
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indication that the PR author has signed a Google Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants