forked from kunchenguid/no-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow_docs_test.go
More file actions
34 lines (29 loc) · 903 Bytes
/
Copy pathworkflow_docs_test.go
File metadata and controls
34 lines (29 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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")
}
}