Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ossf-scorecard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Scorecard analysis workflow
on:
push:
branches:
- main

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed if using Code scanning alerts
security-events: write
# Needed for GitHub OIDC token if publish_results is true
id-token: write

steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Run analysis"
uses: ossf/scorecard-action@v2
with:
results_file: results.sarif
results_format: sarif
# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true

- name: "Upload SARIF results to code scanning"
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
68 changes: 36 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,39 @@ It adds basic PR building, dependabot integration, testing, coverage etc.
```bash
git clone git@github.com:smlx/go-cli-github.git $PROJECT_DIR && rm -rf ./$PROJECT_DIR/.git
```
2. Update the `release` workflow branch from `main` to `foo` to disable it, commit all the files, and push to `main` on a new repo.
2. Update for your project, send a PR and merge it once green:
* rename `deploy/go-cli-github` to `deploy/$YOUR_COMMAND`
* update `deploy/$YOUR_COMMAND/Dockerfile`
* rename `cmd/go-cli-github` to `cmd/$YOUR_COMMAND`
* update `.goreleaser.yml` to build `cmd/$YOUR_COMMAND`
* update the links at the top of the README
* update the `build`, `release`, and `tag-to-release` workflows, replacing `go-cli-github` with `$YOUR_COMMAND`.
* update module in `go.mod` and in `cmd/$YOUR_COMMAND/*.go`, `internal/server/serve_test.go`
3. Go to repository Settings > General:
* Disable wiki and projects
* Allow only merge commits for Pull Requests
* Allow auto-merge
* Automatically delete head branches
4. Go to repository Settings > Branches and add branch protection to `main`, and enable:
* Require a PR before merging
* Dismiss stale pull request approvals
* Require status checks to pass before merging
* Require branches to be up-to-date before merging.
* Required status checks:
* CodeQL
* build
* buildimage
* commitlint
* go-test
* lint
* Include administrators
5. Go to repository Settings > Code security and analysis, and enable:
* Dependabot alerts
* Dependabot security updates
6. When ready to release, rename the target branch in the release workflow from `foo` to `main`, and send a PR.
7. That's it.
1. Update the `release` workflow branch from `main` to `foo` to disable it, commit all the files, and push to `main` on a new repo.
1. Update for your project, send a PR and merge it once green:
* rename `deploy/go-cli-github` to `deploy/$YOUR_COMMAND`
* update `deploy/$YOUR_COMMAND/Dockerfile`
* rename `cmd/go-cli-github` to `cmd/$YOUR_COMMAND`
* update `.goreleaser.yml` to build `cmd/$YOUR_COMMAND`
* update the links at the top of the README
* update the `build`, `release`, and `tag-to-release` workflows, replacing `go-cli-github` with `$YOUR_COMMAND`
* update module in `go.mod` and in `cmd/$YOUR_COMMAND/*.go`, `internal/server/serve_test.go`
1. Go to repository Settings > General:
* Disable wiki and projects
* Allow only merge commits for Pull Requests
* Allow auto-merge
* Automatically delete head branches
1. Go to repository Settings > Branches and add branch protection to `main`, and enable:
* Require a PR before merging
* Dismiss stale pull request approvals
* Require status checks to pass before merging
* Require branches to be up-to-date before merging.
* Required status checks:
* CodeQL
* build
* buildimage
* commitlint
* go-test
* lint
* Include administrators
1. Go to repository Settings > Code security and analysis, and enable:
* Dependabot alerts
* Dependabot security updates
* Secret scanning
* Push protection
1. Go to repository Settings > Actions > General:
* Set Workflow permissions to "Read repository contents and package permissions"
1. When ready to release, rename the target branch in the release workflow from `foo` to `main`, and send a PR.
1. That's it.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/smlx/go-cli-github

go 1.19
go 1.21

require github.com/alecthomas/kong v0.8.1
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0=
github.com/alecthomas/assert/v2 v2.1.0/go.mod h1:b/+1DI2Q6NckYi+3mXyH3wFb8qG37K/DuK80n7WefXA=
github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY=
github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE=
github.com/alecthomas/repr v0.1.0/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=