1
1
name : Get/Update Primer Color Primitives
2
2
3
3
env :
4
- _DEST_DIR : " ${{ github.workspace }}/lua/github-theme/palette/primitives"
5
- _JSON_DIR : " ${{ github.workspace }}/node_modules/@primer/primitives/dist/json/colors"
6
- _LICENSE_GLOB : " ${{ github.workspace }}/node_modules/@primer/primitives/[Ll][Ii][Cc][Ee][Nn][Ss][Ee]*"
7
- _PRIMITIVES_PKGJSON : " ${{ github.workspace }}/node_modules/@primer/primitives/package.json"
4
+ _DEST_DIR : ' ${{ github.workspace }}/lua/github-theme/palette/primitives'
5
+ _JSON_DIR : ' ${{ github.workspace }}/node_modules/@primer/primitives/dist/json/colors'
6
+ _LICENSE_GLOB : ' ${{ github.workspace }}/node_modules/@primer/primitives/[Ll][Ii][Cc][Ee][Nn][Ss][Ee]*'
7
+ _PRIMITIVES_PKGJSON : ' ${{ github.workspace }}/node_modules/@primer/primitives/package.json'
8
8
9
9
on :
10
10
workflow_dispatch :
11
11
schedule :
12
- # 3x per week (every other day) at 12:40pm Pacific Time
13
- - cron : " 40 19 * * 1,3,5"
12
+ - cron : ' 40 19 */14 * *' # Roughly every 14 days (at 12:40pm Pacific Time)
13
+ push :
14
+ branches :
15
+ - ' **' # Any branch, but ignore tag pushes
16
+ paths :
17
+ - .github/workflows/**/*
18
+ - scripts/**/*
19
+ pull_request :
20
+ paths :
21
+ - .github/workflows/**/*
22
+ - scripts/**/*
14
23
15
24
jobs :
16
25
get-colors :
17
26
runs-on : ubuntu-latest
18
- permissions :
27
+ permissions : # NOTE: `write` is not applied for PR's from forks
19
28
checks : write
20
29
contents : write
21
30
issues : write
@@ -28,12 +37,13 @@ jobs:
28
37
29
38
- uses : actions/setup-node@v4
30
39
with :
31
- node-version : " lts/*"
40
+ node-version : lts/*
32
41
check-latest : true
33
42
34
43
- run : npm i @primer/primitives@latest
35
44
36
- - run : |
45
+ - name : Generate Lua files
46
+ run : |
37
47
set -u +f
38
48
shopt -s nocaseglob failglob
39
49
license="$(<$_LICENSE_GLOB)"
@@ -56,15 +66,38 @@ jobs:
56
66
EOF
57
67
done
58
68
59
- - uses : JohnnyMorganz/stylua-action@v4
69
+ - name : Check formatting (stylua)
70
+ uses : JohnnyMorganz/stylua-action@v4
60
71
with :
61
72
token : ${{ secrets.GITHUB_TOKEN }}
62
73
version : latest
63
74
args : -f stylua.toml --verify -- ${{ env._DEST_DIR }}
64
75
65
- - uses : peter-evans/create-pull-request@v6
76
+ - id : diff
77
+ run : git diff --quiet -- "$_DEST_DIR" || echo has_diff=true >> "$GITHUB_OUTPUT"
78
+
79
+ - if : ${{ steps.diff.outputs.has_diff }}
80
+ uses : actions/upload-artifact@v4
81
+ with :
82
+ name : primitives
83
+ path : ${{ env._DEST_DIR }}
84
+ retention-days : ${{ (github.event_name != 'push' || github.ref_name != 'main') && 14 || null }}
85
+ if-no-files-found : error
86
+ overwrite : true
87
+
88
+ - if : ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
89
+ uses : peter-evans/create-pull-request@v6
66
90
with :
67
- commit-message : Update color primitives
68
- branch : update-color-primitives
69
91
delete-branch : true
70
- title : Update color primitives
92
+ branch : generated/primitives/${{ github.ref_name }}
93
+ commit-message : ' deps: update color primitives'
94
+ title : ' deps: update color primitives'
95
+ body : |
96
+ | | |
97
+ | ----------------- | ------------------------ |
98
+ | **Trigger** | ${{ github.event_name }} |
99
+ | **Target Branch** | ${{ github.ref_name }} |
100
+
101
+ > [!NOTE]
102
+ > Checks are not automatically run for this PR.
103
+ > Close and reopen this PR to run tests and checks (against the newly generated primitives).
0 commit comments