nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: stephenh/ts-proto
Pull request #513 (2022-02-17 01:35:22)

fix: Fix snakeToCamel single value parsing.


Patch:
diff --git a/src/options.ts b/src/options.ts
index f1529486..1214dba2 100644
--- a/src/options.ts
+++ b/src/options.ts
@@ -146,6 +146,8 @@ export function optionsFromParameter(parameter: string | undefined): Options {
     options.snakeToCamel = [];
   } else if ((options.snakeToCamel as any) === true) {
     options.snakeToCamel = ['keys', 'json'];
+  } else if (typeof options.snakeToCamel === 'string') {
+    options.snakeToCamel = [options.snakeToCamel];
   }
 
   return options;
@@ -155,8 +157,13 @@ export function optionsFromParameter(parameter: string | undefined): Options {
 function parseParameter(parameter: string): Options {
   const options = {} as any;
   const pairs = parameter.split(',').map((s) => s.split('='));
-  pairs.forEach(([key, value]) => {
-    options[key] = value === 'true' ? true : value === 'false' ? false : value;
+  pairs.forEach(([key, _value]) => {
+    const value = _value === 'true' ? true : _value === 'false' ? false : _value;
+    if (options[key]) {
+      options[key] = [options[key], value];
+    } else {
+      options[key] = value;
+    }
   });
   return options;
 }


Test patch:
diff --git a/tests/options-test.ts b/tests/options-test.ts
index 9b8a89b5..dfca28c7 100644
--- a/tests/options-test.ts
+++ b/tests/options-test.ts
@@ -85,4 +85,14 @@ describe('options', () => {
       useOptionals: 'messages',
     });
   });
+
+  it('can set snakeToCamel as string', () => {
+    const options = optionsFromParameter('snakeToCamel=keys');
+    expect(options).toMatchObject({ snakeToCamel: ['keys'] });
+  });
+
+  it('can set multiple values as an array', () => {
+    const options = optionsFromParameter('foo=one,foo=two');
+    expect(options).toMatchObject({ foo: ['one', 'two'] });
+  });
 });
Repository: pulumi/actions
Pull request #1067 (2024-01-11 01:00:24)

fix user agent
Just a tiny thing I noticed while working with the action. 


Patch:
diff --git a/src/config.ts b/src/config.ts
index 52ca788..5153f84 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -65,7 +65,7 @@ export function makeConfig() {
       policyPackConfigs: parseSemicolorToArray(
         getMultilineInput('policyPackConfigs'),
       ),
-      userAgent: 'pulumi/actions@v3',
+      userAgent: 'pulumi/actions@v5',
       color: getUnionInput('color', {
         alternatives: ['always', 'never', 'raw', 'auto'] as const,
       }),


Test patch:
diff --git a/src/__tests__/config.test.ts b/src/__tests__/config.test.ts
index 8e821ed..df57dc8 100644
--- a/src/__tests__/config.test.ts
+++ b/src/__tests__/config.test.ts
@@ -58,7 +58,7 @@ describe('config.ts', () => {
           "replace": Array [],
           "target": Array [],
           "targetDependents": false,
-          "userAgent": "pulumi/actions@v3",
+          "userAgent": "pulumi/actions@v5",
         },
         "pulumiVersion": "^3",
         "refresh": false,