Skip to content

Commit

Permalink
Merge pull request #1 from fatalbanana/generate_test
Browse files Browse the repository at this point in the history
Add a test to check `go generate` output
  • Loading branch information
fatalbanana authored Aug 20, 2024
2 parents 93f71c9 + 22fd969 commit 9abc9f1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/generate_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: generate_test

on:
schedule:
- cron: "0 0 * * *"
workflow_call:
pull_request:
push:
branches:
- main

jobs:
check_generate:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.4'

- name: Run go generate
run: go generate ./...

- name: Check diff
run: git diff --quiet . || (git --no-pager diff . && exit 1 || exit 1)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## AWS Region Certificates for Go

[![GHA](https://github.com/rspamd/awsregioncertificates/actions/workflows/ci.yml/badge.svg)](https://github.com/rspamd/awsregioncertificates/actions/workflows/ci.yml)
[![GHA](https://github.com/rspamd/awsregioncertificates/actions/workflows/generate_test.yml/badge.svg)](https://github.com/rspamd/awsregioncertificates/actions/workflows/generate_test.yml)

Embeds region certificates from AWS (run `go generate ./...` to refresh them) - AFAIU they can only be downloaded as part of documentation.

Can be used to validate EC2 [instance identity documents](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html) using the `rsa`/`base64-encoded signature`.
Expand Down
2 changes: 1 addition & 1 deletion generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func main() {
}
if tt == html.TextToken && wantText {
token := tokenizer.Token()
regionCertMap[region] = token.String()
regionCertMap[region] = strings.ReplaceAll(token.String(), "\t", "")
wantText = false
}
}
Expand Down

0 comments on commit 9abc9f1

Please sign in to comment.