Repository: cdklabs/cdk-pipelines-github
Pull request #1000 (2024-05-29 07:44:24)

feat(deps): upgrade docker/login-action to v2
To prevent this warning:

> Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: docker/login-action@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

kaizencc: (renaming feat so that we release on this pr)

Patch:
diff --git a/src/pipeline.ts b/src/pipeline.ts
index 0878c19..0a63e7e 100644
--- a/src/pipeline.ts
+++ b/src/pipeline.ts
@@ -878,7 +878,7 @@ export class GitHubWorkflow extends PipelineBase {
 
     return [
       {
-        uses: 'docker/login-action@v2',
+        uses: 'docker/login-action@v3',
         with: params,
       },
     ];


Test patch:
diff --git a/test/__snapshots__/github.cn.test.ts.snap b/test/__snapshots__/github.cn.test.ts.snap
index 27e4422..bffe34d 100644
--- a/test/__snapshots__/github.cn.test.ts.snap
+++ b/test/__snapshots__/github.cn.test.ts.snap
@@ -53,7 +53,7 @@ jobs:
           role-skip-session-tagging: true
           aws-access-key-id: \${{ secrets.AWS_ACCESS_KEY_ID }}
           aws-secret-access-key: \${{ secrets.AWS_SECRET_ACCESS_KEY }}
-      - uses: docker/login-action@v2
+      - uses: docker/login-action@v3
         with:
           registry: 000000000000.dkr.ecr.us-east-1.amazonaws.com
       - id: Publish
diff --git a/test/__snapshots__/github.test.ts.snap b/test/__snapshots__/github.test.ts.snap
index 52b2882..78ef0c2 100644
--- a/test/__snapshots__/github.test.ts.snap
+++ b/test/__snapshots__/github.test.ts.snap
@@ -53,7 +53,7 @@ jobs:
           role-skip-session-tagging: true
           aws-access-key-id: \${{ secrets.AWS_ACCESS_KEY_ID }}
           aws-secret-access-key: \${{ secrets.AWS_SECRET_ACCESS_KEY }}
-      - uses: docker/login-action@v2
+      - uses: docker/login-action@v3
         with:
           registry: 000000000000.dkr.ecr.us-east-1.amazonaws.com
       - id: Publish
diff --git a/test/docker.test.ts b/test/docker.test.ts
index 31e8dbe..5779d37 100644
--- a/test/docker.test.ts
+++ b/test/docker.test.ts
@@ -28,11 +28,11 @@ describe('correct format for docker credentials:', () => {
     const file = fs.readFileSync(github.workflowPath, 'utf-8');
     const workflow = YAML.parse(file);
 
-    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v2');
+    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v3');
 
     expect(steps.length).toEqual(1);
     expect(steps[0]).toEqual({
-      uses: 'docker/login-action@v2',
+      uses: 'docker/login-action@v3',
       with: {
         registry: '000000000000.dkr.ecr.us-east-1.amazonaws.com',
       },
@@ -44,11 +44,11 @@ describe('correct format for docker credentials:', () => {
     const file = fs.readFileSync(github.workflowPath, 'utf-8');
     const workflow = YAML.parse(file);
 
-    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v2');
+    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v3');
 
     expect(steps.length).toEqual(1);
     expect(steps[0]).toEqual({
-      uses: 'docker/login-action@v2',
+      uses: 'docker/login-action@v3',
       with: {
         username: '${{ secrets.DOCKERHUB_USERNAME }}',
         password: '${{ secrets.DOCKERHUB_TOKEN }}',
@@ -67,11 +67,11 @@ describe('correct format for docker credentials:', () => {
     const file = fs.readFileSync(github.workflowPath, 'utf-8');
     const workflow = YAML.parse(file);
 
-    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v2');
+    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v3');
 
     expect(steps.length).toEqual(1);
     expect(steps[0]).toEqual({
-      uses: 'docker/login-action@v2',
+      uses: 'docker/login-action@v3',
       with: {
         username: '${{ secrets.CUSTOM_USERNAME }}',
         password: '${{ secrets.CUSTOM_PASSWORD }}',
@@ -89,18 +89,18 @@ describe('correct format for docker credentials:', () => {
     const file = fs.readFileSync(github.workflowPath, 'utf-8');
     const workflow = YAML.parse(file);
 
-    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v2');
+    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v3');
 
     expect(steps.length).toEqual(2);
     expect(steps[0]).toEqual({
-      uses: 'docker/login-action@v2',
+      uses: 'docker/login-action@v3',
       with: {
         username: '${{ secrets.DOCKERHUB_USERNAME }}',
         password: '${{ secrets.DOCKERHUB_TOKEN }}',
       },
     });
     expect(steps[1]).toEqual({
-      uses: 'docker/login-action@v2',
+      uses: 'docker/login-action@v3',
       with: {
         registry: '000000000000.dkr.ecr.us-east-1.amazonaws.com',
       },
@@ -146,10 +146,10 @@ describe('correct format for docker credentials:', () => {
     const github = createDockerGithubWorkflow(app, [DockerCredential.ghcr()]);
     const file = fs.readFileSync(github.workflowPath, 'utf-8');
     const workflow = YAML.parse(file);
-    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v2');
+    const steps = findStepByJobAndUses(workflow, 'Assets-DockerAsset1', 'docker/login-action@v3');
 
     expect(steps[0]).toEqual({
-      uses: 'docker/login-action@v2',
+      uses: 'docker/login-action@v3',
       with: {
         registry: 'ghcr.io',
         username: '${{ github.actor }}',