-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit.sc
More file actions
executable file
·31 lines (27 loc) · 847 Bytes
/
commit.sc
File metadata and controls
executable file
·31 lines (27 loc) · 847 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
#!/usr/local/bin/amm
// This script looks for changes and makes commits.
import $file.config
import config.Ext._
import scala.language.postfixOps
import sys.process._
var changes = List[String]()
config.urls.foreach { r =>
import r.{ url, folder }
print(s"Checking $folder...")
val result = "git status" at folder;
val shouldUpdate = !result.contains("nothing to commit")
if (shouldUpdate) {
changes ::= folder
println("Commit!")
"git add ." at folder;
"git commit -m \"Updated names for env vars. See https://jira.tid.es/browse/CLA-761.\"" at folder;
"git push -f" at folder;
} else {
println("Skip")
}
}
println(s"Done, changed ${changes.length} repositories")
println(changes)
scala.util.Using(new java.io.FileWriter(new java.io.File("changes.txt"))) { w =>
w.write(changes.mkString("\n").toArray)
}