2022-06-15 16:36:38 -06:00
# Go Dependency Submission
This GitHub Action calculates dependencies for a Go build-target (a Go file with a
`main` function) and submits the list to the [Dependency submission API ](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api ). Dependencies then appear in your repository's dependency graph, and you'll receive Dependabot alerts and updates for vulnerable or out-of-date dependencies.
### Example
```yaml
name : Go Dependency Submission
on :
push :
branches :
- main
2022-06-15 17:21:21 -07:00
# The API requires write permission on the repository to submit dependencies
permissions :
contents : write
2022-06-15 17:15:07 -07:00
# Environment variables to configure Go and Go modules. Customize as necessary
2022-06-15 16:36:38 -06:00
env :
GOPROXY : '' # A Go Proxy server to be used
GOPRIVATE : '' # A list of modules are considered private and not requested from GOPROXY
2022-06-15 17:21:21 -07:00
2022-06-15 16:36:38 -06:00
jobs :
go-action-detection :
runs-on : ubuntu-latest
steps :
- name : 'Checkout Repository'
uses : actions/checkout@v3
2022-06-15 17:21:21 -07:00
2022-06-15 16:36:38 -06:00
- uses : actions/setup-go@v3
with :
go-version : ">=1.18.0"
2022-06-15 17:21:21 -07:00
2022-06-15 16:36:38 -06:00
- name : Run snapshot action
2022-06-16 12:06:01 -04:00
uses : actions/go-dependency-submission@v1
2022-06-15 16:36:38 -06:00
with :
# Required: Define the repo path to the go.mod file used by the
# build target
go-mod-path : go-example/go.mod
#
2022-06-15 17:15:07 -07:00
# Optional: Define the path of a build target (a file with a
2022-06-15 16:36:38 -06:00
# `main()` function) If not defined, this Action will collect all
# dependencies used by all build targets for the module, which may
# include Go dependencies used by tests and tooling.
go-build-target : go-example/cmd/octocat.go
```