Skip to content

Commit 59c24bf

Browse files
committed
Extract repeating parameters
1 parent a32817e commit 59c24bf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: project/scripts/addToBackportingProject.scala

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import sttp.client4.*
88
lazy val apiToken =
99
System.getenv("GRAPHQL_API_TOKEN")
1010

11+
val PROJECT_ID: String = "PVT_kwDOACj3ec4AWSoi"
12+
val FIELD_ID: String = "PVTF_lADOACj3ec4AWSoizgO7uJ4"
13+
1114
case class ID(value: String) derives WrapperVariable
1215

1316
@main def run(number: Int) =
@@ -19,7 +22,7 @@ def getPrData(number: Int): (ID, String) =
1922
val res = query"""
2023
|query getPR {
2124
| repository(owner: "lampepfl", name:"dotty") {
22-
| pullRequest(number: 17570) {
25+
| pullRequest(number: $number) {
2326
| id
2427
| mergedAt
2528
| }
@@ -36,9 +39,9 @@ def timestampItem(id: ID, date: String) =
3639
query"""
3740
|mutation editField {
3841
| updateProjectV2ItemFieldValue(input: {
39-
| projectId: "PVT_kwDOACj3ec4AWSoi",
42+
| projectId: $PROJECT_ID,
4043
| itemId: $id,
41-
| fieldId: "PVTF_lADOACj3ec4AWSoizgO7uJ4",
44+
| fieldId: $FIELD_ID,
4245
| value: { text: $date }
4346
| }) {
4447
| projectV2Item {
@@ -56,7 +59,7 @@ def addItem(id: ID) =
5659
val res = query"""
5760
|mutation addItem {
5861
| addProjectV2ItemById(input: {
59-
| projectId: "PVT_kwDOACj3ec4AWSoi",
62+
| projectId: $PROJECT_ID,
6063
| contentId: $id
6164
| }) {
6265
| item {

0 commit comments

Comments
 (0)