Repository: pulumi/actions
Pull request #753 (2022-10-13 03:35:29)

feat: update action runtime to NodeJS 16
Close https://github.com/pulumi/actions/issues/752

> As a result, actions authors who move from targeting Node.js 12 to Node.js 16 should release with a new major version number to communicate that there is a possible breaking change for GitHub Enterprise Server 3.3 and earlier.

https://github.blog/changelog/2022-05-20-actions-can-now-run-in-a-node-js-16-runtime/ - Github recommends to update major version of action if runtime changes.

Let me know if you would like to keep v3, then I'll revert it back

RobbieMcKinstry: Thanks for this PR @ahanoff . We won't be able to merge until December for the reasons stated in the linked issue, but we'll revisit this PR at that time. 👍🏻  It's very nice to have a PR ready-and-waiting to merge for when the upstream becomes unblocked! :) 
RobbieMcKinstry: GH has delayed the deprecation of GHE v3.3 until 18 Jan 2023. As a result, that's the new "do not merge until" date for this PR. :(
dotansimha: @RobbieMcKinstry can you please elaborate on the need to wait for that specific date? what's preventing us from updating to node16 or node18 and shipping a new version that uses an up-to-date node version right now? 
RobbieMcKinstry: Hi @dotansimha https://github.com/pulumi/actions/issues/752 has a more detailed write-up.
Technically, there's nothing stopping us from cutting a new major release right now. 
ahanoff: https://github.blog/changelog/2023-01-18-code-scanning-codeql-action-v1-is-now-deprecated/
RobbieMcKinstry: @ahanoff, I've rebased this branch off of master, and I'm making a few other tweaks so we can get this in 👍🏻 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3bdb4d5..2251611 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
 
 ## HEAD (Unreleased)
 
-**(none)**
+- feat: set action runtime to NodeJS 16
 
 --
 
diff --git a/README.md b/README.md
index b24a23e..5cfd490 100644
--- a/README.md
+++ b/README.md
@@ -22,8 +22,8 @@ jobs:
     name: Preview
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: pulumi/actions@v3
+      - uses: actions/checkout@v3
+      - uses: pulumi/actions@v4
         with:
           command: preview
           stack-name: org-name/stack-name
@@ -152,7 +152,7 @@ We can see that `pet-name` is an output. To get the value of this output in the
 action, we would use code similar to the following:
 
 ```yaml
-- uses: pulumi/actions@v3
+- uses: pulumi/actions@v4
   id: pulumi
   env:
     PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
diff --git a/action.yml b/action.yml
index 4048c55..7ce496e 100644
--- a/action.yml
+++ b/action.yml
@@ -104,5 +104,5 @@ runs:
   #
   # Trying to upgrade in July 2022 broke our users that depend on
   # GitHub Enterprise versions < 3.4
-  using: 'node12'
+  using: 'node16'
   main: 'dist/index.js'
diff --git a/examples/dotnet-pulumi.yaml b/examples/dotnet-pulumi.yaml
index 72f4301..4e8083c 100644
--- a/examples/dotnet-pulumi.yaml
+++ b/examples/dotnet-pulumi.yaml
@@ -17,7 +17,7 @@ jobs:
           dotnet-version: 3.1
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/go-pulumi.yaml b/examples/go-pulumi.yaml
index 0b0c7bd..c97d246 100644
--- a/examples/go-pulumi.yaml
+++ b/examples/go-pulumi.yaml
@@ -20,7 +20,7 @@ jobs:
         run: go mod download
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/nodejs-aws.yaml b/examples/nodejs-aws.yaml
index f0f175f..a08cb5d 100644
--- a/examples/nodejs-aws.yaml
+++ b/examples/nodejs-aws.yaml
@@ -21,7 +21,7 @@ jobs:
         run: yarn install
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/nodejs-azure.yaml b/examples/nodejs-azure.yaml
index 359062f..5eb5108 100644
--- a/examples/nodejs-azure.yaml
+++ b/examples/nodejs-azure.yaml
@@ -21,7 +21,7 @@ jobs:
         run: yarn install
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/nodejs-google.yaml b/examples/nodejs-google.yaml
index 23f9e1a..474eeec 100644
--- a/examples/nodejs-google.yaml
+++ b/examples/nodejs-google.yaml
@@ -28,7 +28,7 @@ jobs:
           export_default_credentials: true
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/nodejs-local.yaml b/examples/nodejs-local.yaml
index 17e8863..fa4d097 100644
--- a/examples/nodejs-local.yaml
+++ b/examples/nodejs-local.yaml
@@ -21,7 +21,7 @@ jobs:
         run: yarn install
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/nodejs-pulumi.yaml b/examples/nodejs-pulumi.yaml
index 5392af4..60224b2 100644
--- a/examples/nodejs-pulumi.yaml
+++ b/examples/nodejs-pulumi.yaml
@@ -21,7 +21,7 @@ jobs:
         run: yarn install
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/examples/python-pulumi.yaml b/examples/python-pulumi.yaml
index 6e797fa..7b78325 100644
--- a/examples/python-pulumi.yaml
+++ b/examples/python-pulumi.yaml
@@ -20,7 +20,7 @@ jobs:
         run: pip install -r requirements.txt
 
       - name: Applying infrastructure 🚀
-        uses: pulumi/actions@v3
+        uses: pulumi/actions@v4
         with:
           command: up
           stack-name: dev
diff --git a/src/config.ts b/src/config.ts
index a46ed68..394044b 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -24,7 +24,7 @@ export const options = rt.Partial({
   policyPackConfigs: rt.Array(rt.String),
   targetDependents: rt.Boolean,
   editCommentOnPr: rt.Boolean,
-  userAgent: rt.Literal('pulumi/actions@v3'),
+  userAgent: rt.Literal('pulumi/actions@v4'),
   pulumiVersion: rt.String,
 });
 
@@ -81,7 +81,7 @@ export async function makeConfig(): Promise<Config> {
       policyPacks: parseArray(getInput('policyPacks')),
       policyPackConfigs: parseArray(getInput('policyPackConfigs')),
       editCommentOnPr: parseBoolean(getInput('edit-pr-comment')),
-      userAgent: 'pulumi/actions@v3',
+      userAgent: 'pulumi/actions@v4',
       pulumiVersion: getInput('pulumi-version') || "^3",
       color: getInput('color'),
     },


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 1bc69b7..8b6c3f0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -19,7 +19,7 @@ jobs:
       - uses: actions/checkout@v3
       - uses: actions/setup-node@v3
         with:
-          node-version: 14.x
+          node-version: 16.x
           cache: yarn
       - run: yarn install
       - run: yarn build
@@ -39,7 +39,7 @@ jobs:
           PULUMI_CONFIG_PASSPHRASE: not-a-secret
       - uses: actions/setup-node@v3
         with:
-          node-version: 14.x
+          node-version: 16.x
           cache: yarn
       - run: yarn install
       - run: yarn build
diff --git a/src/__tests__/config.test.ts b/src/__tests__/config.test.ts
index b8da0c9..02d5689 100644
--- a/src/__tests__/config.test.ts
+++ b/src/__tests__/config.test.ts
@@ -51,7 +51,7 @@ describe('config.ts', () => {
           "replace": undefined,
           "target": undefined,
           "targetDependents": undefined,
-          "userAgent": "pulumi/actions@v3",
+          "userAgent": "pulumi/actions@v4",
         },
         "refresh": undefined,
         "remove": undefined,
@@ -116,7 +116,7 @@ describe('config.ts', () => {
           "replace": undefined,
           "target": undefined,
           "targetDependents": undefined,
-          "userAgent": "pulumi/actions@v3",
+          "userAgent": "pulumi/actions@v4",
         },
         "refresh": undefined,
         "remove": undefined,
@@ -173,7 +173,7 @@ describe('config.ts', () => {
           "replace": undefined,
           "target": undefined,
           "targetDependents": undefined,
-          "userAgent": "pulumi/actions@v3",
+          "userAgent": "pulumi/actions@v4",
         },
         "refresh": undefined,
         "remove": undefined,