{"id":22506342,"url":"https://github.com/the-gophers/go-action","last_synced_at":"2026-02-28T18:02:13.411Z","repository":{"id":45535407,"uuid":"310909450","full_name":"the-gophers/go-action","owner":"the-gophers","description":"Template providing a starting point for building a GitHub Action based in Go","archived":false,"fork":false,"pushed_at":"2021-12-09T21:26:43.000Z","size":28,"stargazers_count":32,"open_issues_count":1,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-03T12:43:20.312Z","etag":null,"topics":["actions","golang","gophercon"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-gophers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-07T18:40:21.000Z","updated_at":"2024-02-20T13:44:32.000Z","dependencies_parsed_at":"2022-08-28T13:21:25.407Z","dependency_job_id":null,"html_url":"https://github.com/the-gophers/go-action","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/the-gophers/go-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-gophers%2Fgo-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-gophers%2Fgo-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-gophers%2Fgo-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-gophers%2Fgo-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-gophers","download_url":"https://codeload.github.com/the-gophers/go-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-gophers%2Fgo-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29946463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T17:57:52.716Z","status":"ssl_error","status_checked_at":"2026-02-28T17:57:31.974Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","golang","gophercon"],"created_at":"2024-12-07T00:43:09.692Z","updated_at":"2026-02-28T18:02:13.372Z","avatar_url":"https://github.com/the-gophers.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Action Using Go\nThis is a starting point for a GitHub Action based in Go. This repo provides all the structure needed to build\na robust GitHub action using Go and following action development best practices.\n\n## Getting Started\nThis is a GitHub template repo, so when you click \"Use this template\", it will create a new copy of this\ntemplate in your org or personal repo of choice. Once you have created a repo from this template, you\nshould be able to clone and navigate to the root of the repository.\n\n### First Build\nFrom the root of your repo, you should be able to run the following to build and test the Go action.\n```shell script\ngo build ./...\ngo test ./...\n```\n\n### What's in Here?\n\n```\n.\n├── Dockerfile\n├── LICENSE\n├── README.md\n├── action.yaml\n├── go.mod\n├── go.sum\n├── main.go\n└── pkg\n    └── tweeter\n        ├── tweeter.go\n        └── tweeter_test.go\n```\n\n#### [action.yaml](./action.yaml)\nThe `action.yml` file contains the metadata which describes our action. This includes, but is not limited\nto the following.\n- name, description and author\n- inputs\n- outputs\n- branding\n- runs\n\nYou will see an example structure already exists. The example executes the Dockerfile and provides to it\nthe arguments described in the `runs` section. We map the sample input to the arguments of the Dockerfile.\n\nBy setting `runs.using: docker` we are telling the Actions runtime to execute the Dockerfile when the\nAction is used in a workflow.\n\nBy setting `runs.image: Dockerfile` we are telling the Actions runtime to build and then execute the\nDockerfile at the entrypoint defined in the Dockerfile. The build for the Dockerfile will happen\neach time the Action is executed, which can take a considerable amount of time depending on how long\nit takes to build your Go code. Later, we'll change this to a pre-built image for optimization. \n\n#### [Dockerfile](./Dockerfile)\nThis Dockerfile should look relatively familiar to folks who use containers to build Go code. We create a\nbuilder intermediate image based on Go 1.15.2, pull in the source, and build the application. After the\napplication has been built, the statically linked binary is copied into a thin image, which results in \nan image of roughly 8 MB.\n\n#### [go.mod](./go.mod) / [go.sum](./go.sum)\nGo module definition which will need to be updated with the name of your module.\n\n#### [main.go](./main.go)\nThis is the Go entrypoint for your GitHub Action. It is a simple command line application which can be\nexecuted outside the context of the Action by running the following. This is where you will add your Go code for your \nAction.\n\n#### [.github/workflows/tweeter-automation.yaml](.github/workflows/tweeter-automation.yaml)\nThis is the continuous integration / CLI release automation. The release workflow defined in this automation will\nis triggered by tags shaped like `v1.2.3`, and will create a GitHub release for a pushed tag. The release will \nuse the [./github/release.yml](.github/release.yml) to automatically generate structured release notes based on\npull request tags.\n\n#### [.github/workflows/action-version.yaml](./.github/workflows/action-version.yaml)\nThis action triggers when a new release is published. Upon publication of the new release, this will tag the repository\nwith the shortened major semantic version pointing at the highest semantic version within that major version. For \nexample, `v1.2.2` and `v1` point to the same ref `xyz`, a new tag is introduced `v1.2.3` which points to ref `abc`, this \naction will move the `v1` tag to point to `abc` rather than `xyz`. This enables consumers of an action to take a \n\"floating\" major semantic version dependency, like `my-action@v1`. \n\n#### [.github/workflows/image-release.yaml](./.github/workflows/image-release.yaml)\nThis action runs on tags shaped like `image-v1.2.3`, and will build and push a container image to the\nGitHub Container Registry.\n\nThis action is super useful for optimizing the execution time of your action. By pre-building the\nimage used in the Action, each invocation of your action can reference the image and not have to\nrebuild it for each invocation.\n\nOnce you push your first image you will also need to update the Container Registry to allow public access.\n\n## Lab Video\nTODO: record and post the first lab walking through creation, execution and optimization\n\n## Lab Instructions\n1) Click on \"Use this template\" on https://github.com/the-gophers/go-action, and create a repo of your own. I'm going \n   to call mine \"templated-action\", make it public, and click \"Create repository from template\".\n2) Clone your newly crated repo\n3) Run `go run . -h`.\n5) Run\n    ```shell script\n    $ go run . --dryRun --message hello\n    ::set-output name=sentMessage::hello\n    ```\n6) Checkout a new branch and let's make this our own GitHub Action. Run `git checkout -b my-action`\n7) Update `./action.yml` name, description, and author to something reasonable. The `name` field needs to be\n   unique to others in the store.\n8) When you are done with your changes, commit them, push your branch to GitHub, and open a pull request. In the PR,\n   you should see the CI action run and complete successfully. LGTM! Let's merge these changes. Click the\n   \"Merge pull request\" button, then delete the branch.\n9) Check out `main` and pull down the latest changes from GitHub (`git pull`).\n11) In `test-repo` click on Actions and run `test-action` with the inputs you desire. Navigate the UI to the running\n    action and see that it built the action, built the Dockerfile and executed the entrypoint Go application. Also note\n    how long it took to run the action. **Using a Dockerfile will cause it to rebuild that image EACH time the action\n    runs!**. We can do better than that. More ahead.\n12) Let's tag our first release (`git tag v1.0.0`) and push the tag\n    (`git push origin v1.0.0`). This should create our first release in GitHub via the `release action` workflow.\n13) Navigate to the `v1.0.0` release and click edit. Within the release edit page, you should see \"Publish this Action to the GitHub Marketplace\".\n    If you check that box, your action will now be publicly advertised to all of GitHub!\n14) **PSA:** The rest of this is optional. If you don't care about your action going fast, stop right here.\n15) Now we are going to make this **FAST** by pre-baking our container image. Go back to `templated-action` and edit\n    `./github/workflows/release-image.yml`. Change `docker.pkg.github.com/owner/` to use your repo owner for `owner`.\n    Commit and push the changes.\n17) Now tag the repo with `git tag image-v1.0.0` and then push the tag `git push origin image-v1.0.0`. This will\n    kick off the image release build.\n18) Replace `image: Dockerfile` with `image: docker://ghcr.io/your-repo/your-image:1.0.0` replacing the repo and image name.\n    Commit the changes and tag a new release of the Action as done in #12.\n19) Rerun the continuous integration and see how much faster the action runs now that it doesn't have to rebuild\n    the container image each time.\n    \n\n\n## Contributions\nAlways welcome! Please open a PR or an issue, and remember to follow the [Gopher Code of Conduct](https://www.gophercon.com/page/1475132/code-of-conduct).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-gophers%2Fgo-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-gophers%2Fgo-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-gophers%2Fgo-action/lists"}