Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
appwrite/.github/scripts/changes.mjs at main · appwrite/appwrite · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
appwrite
appwrite
Repository navigation
Code
Issues
369
(369)
Pull requests
442
(442)
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
appwrite
/
.github
/
scripts
/
changes.mjs
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
175 lines (160 loc) · 5.44 KB
main
Breadcrumbs
appwrite
/
.github
/
scripts
/
changes.mjs
Copy path
Top
File metadata and controls
Code
Blame
175 lines (160 loc) · 5.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Decides what a CI run tests from the files it changed, using .github/ci/e2e.json.
// A file no rule claims runs every lane, so a gap in the map costs time, not coverage.
// Release branches (the nightly builds from them) and manual runs test
// everything. Every push runs every server lane, so PRs that each ran a subset
// are checked together after merge and main's tip is never green on a skip.
import
{
execFileSync
}
from
"node:child_process"
;
import
{
appendFileSync
,
readFileSync
}
from
"node:fs"
;
const
config
=
JSON
.
parse
(
readFileSync
(
new
URL
(
"../ci/e2e.json"
,
import
.
meta
.
url
)
)
,
)
;
const
event
=
process
.
env
.
EVENT
;
const
ref
=
process
.
env
.
REF
??
""
;
const
git
=
(
...
args
)
=>
execFileSync
(
"git"
,
args
,
{
encoding
:
"utf8"
,
maxBuffer
:
64
*
1024
*
1024
}
)
;
// `*.ext` matches by extension; any other pattern is a path prefix in which a
// `*` segment matches one directory.
const
matches
=
(
file
,
pattern
)
=>
{
if
(
pattern
.
startsWith
(
"*."
)
)
{
return
file
.
endsWith
(
pattern
.
slice
(
1
)
)
;
}
const
want
=
pattern
.
split
(
"/"
)
;
const
have
=
file
.
split
(
"/"
)
;
if
(
have
.
length
<
want
.
length
)
{
return
false
;
}
return
want
.
every
(
(
segment
,
index
)
=>
{
if
(
segment
===
"*"
)
{
return
true
;
}
return
index
===
want
.
length
-
1
?
have
[
index
]
.
startsWith
(
segment
)
:
have
[
index
]
===
segment
;
}
)
;
}
;
const
claims
=
(
file
,
patterns
)
=>
patterns
.
some
(
(
pattern
)
=>
matches
(
file
,
pattern
)
)
;
const
base
=
(
)
=>
{
if
(
event
===
"pull_request"
)
{
// The checkout is GitHub's merge commit; its first parent is the base tip it
// merges onto, so the diff holds only this PR's changes.
const
[
,
parent
,
other
]
=
git
(
"rev-list"
,
"--parents"
,
"-n"
,
"1"
,
"HEAD"
)
.
trim
(
)
.
split
(
" "
)
;
return
other
?
parent
:
git
(
"merge-base"
,
`origin/
${
process
.
env
.
BASE_REF
}
`
,
"HEAD"
)
.
trim
(
)
;
}
if
(
event
===
"merge_group"
)
{
return
process
.
env
.
MERGE_BASE
;
}
try
{
git
(
"rev-parse"
,
"-q"
,
"--verify"
,
`
${
process
.
env
.
BEFORE
}
^{commit}`
)
;
return
process
.
env
.
BEFORE
;
}
catch
{
return
git
(
"rev-parse"
,
"HEAD~1"
)
.
trim
(
)
;
}
}
;
// Every library whose queries run on the matrix databases; usage writes to ClickHouse instead.
const
databaseLibraries
=
[
"abuse"
,
"audit"
,
"database"
,
"migration"
,
"mongo"
,
"query"
,
]
;
// A branch constraint locks the branch name as the version on every update,
// so only the source commit tells two builds of the same branch apart.
const
databaseReferences
=
(
commit
)
=>
{
const
lock
=
JSON
.
parse
(
git
(
"show"
,
`
${
commit
}
:composer.lock`
)
)
;
return
databaseLibraries
.
map
(
(
name
)
=>
{
const
entry
=
lock
.
packages
?.
find
(
(
item
)
=>
item
.
name
===
`utopia-php/
${
name
}
`
,
)
;
return
`
${
name
}
@
${
entry
?.
source
?.
reference
??
entry
?.
version
??
""
}
`
;
}
)
.
join
(
","
)
;
}
;
const
everything
=
event
===
"workflow_dispatch"
||
(
ref
.
startsWith
(
"refs/heads/"
)
&&
ref
.
endsWith
(
".x"
)
)
;
const
from
=
everything
?
null
:
base
(
)
;
let
server
=
everything
||
event
===
"push"
;
let
frontend
=
everything
;
let
all
=
everything
||
event
===
"push"
;
let
databasePackagesChanged
=
false
;
const
selected
=
new
Set
(
)
;
if
(
!
everything
)
{
// Without renames, a move out of the server still counts its source.
const
files
=
git
(
"diff"
,
"--name-only"
,
"--no-renames"
,
from
,
"HEAD"
)
.
split
(
"\n"
)
.
filter
(
Boolean
)
;
// An absorbed library leaves the lock and moves with its packages/ directory.
databasePackagesChanged
=
files
.
some
(
(
file
)
=>
databaseLibraries
.
some
(
(
name
)
=>
file
.
startsWith
(
`packages/
${
name
}
/`
)
)
,
)
;
for
(
const
file
of
files
)
{
if
(
claims
(
file
,
config
.
paths
.
all
)
)
{
server
=
frontend
=
all
=
true
;
}
else
if
(
claims
(
file
,
config
.
paths
.
console
)
)
{
frontend
=
true
;
}
else
if
(
claims
(
file
,
config
.
paths
.
checks
)
)
{
server
=
true
;
}
else
if
(
claims
(
file
,
config
.
paths
.
ignore
)
)
{
continue
;
}
else
{
server
=
true
;
const
owners
=
config
.
services
.
filter
(
(
service
)
=>
file
.
startsWith
(
`tests/e2e/Services/
${
service
.
name
}
/`
)
||
claims
(
file
,
service
.
paths
)
,
)
;
if
(
owners
.
length
===
0
)
{
all
=
true
;
}
owners
.
forEach
(
(
service
)
=>
selected
.
add
(
service
.
name
)
)
;
}
}
}
const
services
=
config
.
services
.
filter
(
(
service
)
=>
server
&&
(
all
||
selected
.
has
(
service
.
name
)
)
)
.
map
(
(
{
paths
,
...
service
}
)
=>
service
)
;
const
names
=
new
Set
(
services
.
map
(
(
service
)
=>
service
.
name
)
)
;
const
groups
=
config
.
groups
.
filter
(
(
group
)
=>
server
&&
(
all
||
group
.
services
.
some
(
(
name
)
=>
names
.
has
(
name
)
)
)
,
)
.
map
(
(
{
services
,
...
group
}
)
=>
group
)
;
const
full
=
event
===
"workflow_dispatch"
||
(
server
&&
(
event
===
"pull_request"
||
event
===
"merge_group"
)
&&
(
databasePackagesChanged
||
databaseReferences
(
from
)
!==
databaseReferences
(
"HEAD"
)
)
)
;
const
outputs
=
{
server
,
console
:
frontend
,
services
:
JSON
.
stringify
(
services
)
,
groups
:
JSON
.
stringify
(
groups
)
,
databases
:
JSON
.
stringify
(
full
?
[
"MariaDB"
,
"PostgreSQL"
,
"MongoDB"
]
:
[
"PostgreSQL"
]
,
)
,
modes
:
JSON
.
stringify
(
full
?
[
"dedicated"
,
"shared"
]
:
[
"dedicated"
]
)
,
}
;
if
(
process
.
env
.
GITHUB_OUTPUT
)
{
appendFileSync
(
process
.
env
.
GITHUB_OUTPUT
,
Object
.
entries
(
outputs
)
.
map
(
(
[
key
,
value
]
)
=>
`
${
key
}
=
${
value
}
\n`
)
.
join
(
""
)
,
)
;
}
console
.
log
(
`base
${
from
??
"(everything)"
}
: server=
${
server
}
console=
${
frontend
}
`
,
)
;
console
.
log
(
`e2e:
${
all
?
"all"
:
[
...
names
]
.
join
(
", "
)
||
"none"
}
; groups:
${
groups
.
map
(
(
group
)
=>
group
.
label
)
.
join
(
", "
)
||
"none"
}
`
,
)
;
You can’t perform that action at this time.