26f897c1ec
release / release-please (push) Failing after 1m49s
docs / build (push) Failing after 6m34s
docs / deploy (push) Waiting to run
release / build-and-upload (arm64, linux) (push) Has been cancelled
release / build-and-upload (arm64, windows) (push) Has been cancelled
release / build-darwin (amd64, darwin) (push) Has been cancelled
release / checksums (push) Has been cancelled
release / finalize (push) Has been cancelled
release / build-darwin (arm64, darwin) (push) Has been cancelled
release / build-and-upload (amd64, linux) (push) Has been cancelled
release / build-and-upload (amd64, windows) (push) Has been cancelled
35 lines
903 B
Go
35 lines
903 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDocsWorkflowUsesScopedConcurrencyGroup(t *testing.T) {
|
|
data, err := os.ReadFile(".github/workflows/docs.yml")
|
|
if err != nil {
|
|
t.Fatalf("read workflow: %v", err)
|
|
}
|
|
|
|
content := string(data)
|
|
if !strings.Contains(content, "group: pages-${{ github.event_name }}-${{ github.ref }}") {
|
|
t.Fatalf("docs workflow must scope concurrency by event and ref")
|
|
}
|
|
if strings.Contains(content, "group: pages\n") {
|
|
t.Fatalf("docs workflow must not use a global concurrency group")
|
|
}
|
|
}
|
|
|
|
func TestDocsWorkflowSkipsPagesSetupOnPullRequests(t *testing.T) {
|
|
data, err := os.ReadFile(".github/workflows/docs.yml")
|
|
if err != nil {
|
|
t.Fatalf("read workflow: %v", err)
|
|
}
|
|
|
|
content := string(data)
|
|
if !strings.Contains(content, "if: github.event_name != 'pull_request'") {
|
|
t.Fatalf("docs workflow must skip Pages-only setup on pull requests")
|
|
}
|
|
}
|