Skip to content

Commit

Permalink
Extract repeating parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Kordyjan committed Oct 27, 2023
1 parent a32817e commit 59c24bf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions project/scripts/addToBackportingProject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import sttp.client4.*
lazy val apiToken =
System.getenv("GRAPHQL_API_TOKEN")

val PROJECT_ID: String = "PVT_kwDOACj3ec4AWSoi"
val FIELD_ID: String = "PVTF_lADOACj3ec4AWSoizgO7uJ4"

case class ID(value: String) derives WrapperVariable

@main def run(number: Int) =
Expand All @@ -19,7 +22,7 @@ def getPrData(number: Int): (ID, String) =
val res = query"""
|query getPR {
| repository(owner: "lampepfl", name:"dotty") {
| pullRequest(number: 17570) {
| pullRequest(number: $number) {
| id
| mergedAt
| }
Expand All @@ -36,9 +39,9 @@ def timestampItem(id: ID, date: String) =
query"""
|mutation editField {
| updateProjectV2ItemFieldValue(input: {
| projectId: "PVT_kwDOACj3ec4AWSoi",
| projectId: $PROJECT_ID,
| itemId: $id,
| fieldId: "PVTF_lADOACj3ec4AWSoizgO7uJ4",
| fieldId: $FIELD_ID,
| value: { text: $date }
| }) {
| projectV2Item {
Expand All @@ -56,7 +59,7 @@ def addItem(id: ID) =
val res = query"""
|mutation addItem {
| addProjectV2ItemById(input: {
| projectId: "PVT_kwDOACj3ec4AWSoi",
| projectId: $PROJECT_ID,
| contentId: $id
| }) {
| item {
Expand Down

0 comments on commit 59c24bf

Please sign in to comment.