Code Monkey home page Code Monkey logo

Comments (3)

rapus95 avatar rapus95 commented on July 2, 2024

related: Gnimuc/Sodium.jl#1

from github.jl.

rapus95 avatar rapus95 commented on July 2, 2024

Update: I wrote my own script which now can be found in https://github.com/rapus95/HubCLI.jl

Maybe you can use some parts of it to integrate the capability into GitHub.jl aswell.

from github.jl.

rapus95 avatar rapus95 commented on July 2, 2024

More specifically you only need a dependency on Sodium.jl and code that resembles that snippet:

    function push_secret!(remote_gh_url, pairs::Pair{String,Base.SecretBuffer}...)
        result, _, _ = hub(:api, "/repos/$remote_gh_url/actions/secrets/public-key")
        answer = JSON3.read(result)
        get(answer, :message, nothing) == "Not Found" && error("Something went wrong at retrieving the public api key")

        requestjson = IOBuffer()
        requestbody = Dict{Symbol,Any}(:key_id=>answer[:key_id])
        for (secretname, secretvalue) in pairs
            requestbody[:encrypted_value] = Sodium.seal(secretvalue, answer[:key])
            JSON3.write(requestjson, requestbody)
            seekstart(requestjson)
            ack = hub(:api, "-X", :PUT, "/repos/$remote_gh_url/actions/secrets/$secretname", "--input", "-", input=requestjson)
            truncate(requestjson, 0)
            isempty(ack[1]) || error(ack[2])
        end
    end

from github.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.