Add manifest
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 57s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 57s
This commit is contained in:
parent
971e77229a
commit
53002d1e97
19
action.yaml
Normal file
19
action.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# action.yml
|
||||||
|
name: "IPFS Node Pin"
|
||||||
|
description: "Pin a directory to an IPFS node using its HTTP API"
|
||||||
|
inputs:
|
||||||
|
ipfs_host:
|
||||||
|
description: "IPFS node host"
|
||||||
|
required: true
|
||||||
|
ipfs_port:
|
||||||
|
description: "IPFS node port"
|
||||||
|
required: true
|
||||||
|
path_to_add:
|
||||||
|
description: "Directory path to pin"
|
||||||
|
required: true
|
||||||
|
outputs:
|
||||||
|
cid:
|
||||||
|
description: "CID of pinned directory"
|
||||||
|
runs:
|
||||||
|
using: "docker"
|
||||||
|
image: "Dockerfile"
|
7
main.go
7
main.go
@ -38,11 +38,6 @@ func main() {
|
|||||||
githubactions.Fatalf("Missing: ipfs_port")
|
githubactions.Fatalf("Missing: ipfs_port")
|
||||||
}
|
}
|
||||||
|
|
||||||
token := githubactions.GetInput("ipfs_token")
|
|
||||||
if token == "" {
|
|
||||||
githubactions.Fatalf("Missing: ipfs_token")
|
|
||||||
}
|
|
||||||
|
|
||||||
targetPath, err := os.Open(path)
|
targetPath, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
githubactions.Fatalf("Unable to access path_to_add: %v", err.Error())
|
githubactions.Fatalf("Unable to access path_to_add: %v", err.Error())
|
||||||
@ -117,5 +112,5 @@ func main() {
|
|||||||
var ipfsAddResponse AddResponse
|
var ipfsAddResponse AddResponse
|
||||||
json.Unmarshal(resBody, &ipfsAddResponse)
|
json.Unmarshal(resBody, &ipfsAddResponse)
|
||||||
|
|
||||||
fmt.Println(ipfsAddResponse.Hash)
|
githubactions.SetOutput("cid", ipfsAddResponse.Hash)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user