From 32ebaaff2a68f4166aa63662539a69bf90806c33 Mon Sep 17 00:00:00 2001
From: Owen Farrell <owen.farrell@gmail.com>
Date: Fri, 19 Jun 2020 16:25:52 -0400
Subject: [PATCH 1/2] Support downloads from other workflows

Signed-off-by: Owen Farrell <owen.farrell@gmail.com>
---
 packages/artifact/package-lock.json           | 301 +++++++++++++++++-
 packages/artifact/package.json                |   1 +
 .../artifact/src/internal/artifact-client.ts  |  33 +-
 .../src/internal/download-http-client.ts      | 128 +++++++-
 4 files changed, 454 insertions(+), 9 deletions(-)

diff --git a/packages/artifact/package-lock.json b/packages/artifact/package-lock.json
index ba9dcfbc8f..7d8140b4ab 100644
--- a/packages/artifact/package-lock.json
+++ b/packages/artifact/package-lock.json
@@ -5,9 +5,20 @@
   "requires": true,
   "dependencies": {
     "@actions/core": {
-      "version": "1.2.3",
-      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz",
-      "integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
+      "version": "1.2.4",
+      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
+      "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
+    },
+    "@actions/github": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/@actions/github/-/github-3.0.0.tgz",
+      "integrity": "sha512-zSYo0Pzh/AZt0DCBjCUhd9lNBECbbWnPqq5L32DZDTuEhjGJM8VSgOpKSol9climaJxhPJQhu+vUZIZuQi4Z1w==",
+      "requires": {
+        "@actions/http-client": "^1.0.3",
+        "@octokit/core": "^2.5.1",
+        "@octokit/plugin-paginate-rest": "^2.2.0",
+        "@octokit/plugin-rest-endpoint-methods": "^3.10.0"
+      }
     },
     "@actions/http-client": {
       "version": "1.0.8",
@@ -17,6 +28,112 @@
         "tunnel": "0.0.6"
       }
     },
+    "@octokit/auth-token": {
+      "version": "2.4.2",
+      "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz",
+      "integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==",
+      "requires": {
+        "@octokit/types": "^5.0.0"
+      }
+    },
+    "@octokit/core": {
+      "version": "2.5.4",
+      "resolved": "https://registry.npmjs.org/@octokit/core/-/core-2.5.4.tgz",
+      "integrity": "sha512-HCp8yKQfTITYK+Nd09MHzAlP1v3Ii/oCohv0/TW9rhSLvzb98BOVs2QmVYuloE6a3l6LsfyGIwb6Pc4ycgWlIQ==",
+      "requires": {
+        "@octokit/auth-token": "^2.4.0",
+        "@octokit/graphql": "^4.3.1",
+        "@octokit/request": "^5.4.0",
+        "@octokit/types": "^5.0.0",
+        "before-after-hook": "^2.1.0",
+        "universal-user-agent": "^5.0.0"
+      }
+    },
+    "@octokit/endpoint": {
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.3.tgz",
+      "integrity": "sha512-Y900+r0gIz+cWp6ytnkibbD95ucEzDSKzlEnaWS52hbCDNcCJYO5mRmWW7HRAnDc7am+N/5Lnd8MppSaTYx1Yg==",
+      "requires": {
+        "@octokit/types": "^5.0.0",
+        "is-plain-object": "^3.0.0",
+        "universal-user-agent": "^5.0.0"
+      }
+    },
+    "@octokit/graphql": {
+      "version": "4.5.1",
+      "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.1.tgz",
+      "integrity": "sha512-qgMsROG9K2KxDs12CO3bySJaYoUu2aic90qpFrv7A8sEBzZ7UFGvdgPKiLw5gOPYEYbS0Xf8Tvf84tJutHPulQ==",
+      "requires": {
+        "@octokit/request": "^5.3.0",
+        "@octokit/types": "^5.0.0",
+        "universal-user-agent": "^5.0.0"
+      }
+    },
+    "@octokit/plugin-paginate-rest": {
+      "version": "2.2.3",
+      "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.2.3.tgz",
+      "integrity": "sha512-eKTs91wXnJH8Yicwa30jz6DF50kAh7vkcqCQ9D7/tvBAP5KKkg6I2nNof8Mp/65G0Arjsb4QcOJcIEQY+rK1Rg==",
+      "requires": {
+        "@octokit/types": "^5.0.0"
+      }
+    },
+    "@octokit/plugin-rest-endpoint-methods": {
+      "version": "3.17.0",
+      "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.17.0.tgz",
+      "integrity": "sha512-NFV3vq7GgoO2TrkyBRUOwflkfTYkFKS0tLAPym7RNpkwLCttqShaEGjthOsPEEL+7LFcYv3mU24+F2yVd3npmg==",
+      "requires": {
+        "@octokit/types": "^4.1.6",
+        "deprecation": "^2.3.1"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "4.1.10",
+          "resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.1.10.tgz",
+          "integrity": "sha512-/wbFy1cUIE5eICcg0wTKGXMlKSbaAxEr00qaBXzscLXpqhcwgXeS6P8O0pkysBhRfyjkKjJaYrvR1ExMO5eOXQ==",
+          "requires": {
+            "@types/node": ">= 8"
+          }
+        }
+      }
+    },
+    "@octokit/request": {
+      "version": "5.4.5",
+      "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.5.tgz",
+      "integrity": "sha512-atAs5GAGbZedvJXXdjtKljin+e2SltEs48B3naJjqWupYl2IUBbB/CJisyjbNHcKpHzb3E+OYEZ46G8eakXgQg==",
+      "requires": {
+        "@octokit/endpoint": "^6.0.1",
+        "@octokit/request-error": "^2.0.0",
+        "@octokit/types": "^5.0.0",
+        "deprecation": "^2.0.0",
+        "is-plain-object": "^3.0.0",
+        "node-fetch": "^2.3.0",
+        "once": "^1.4.0",
+        "universal-user-agent": "^5.0.0"
+      }
+    },
+    "@octokit/request-error": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz",
+      "integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==",
+      "requires": {
+        "@octokit/types": "^5.0.1",
+        "deprecation": "^2.0.0",
+        "once": "^1.4.0"
+      }
+    },
+    "@octokit/types": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.0.1.tgz",
+      "integrity": "sha512-GorvORVwp244fGKEt3cgt/P+M0MGy4xEDbckw+K5ojEezxyMDgCaYPKVct+/eWQfZXOT7uq0xRpmrl/+hliabA==",
+      "requires": {
+        "@types/node": ">= 8"
+      }
+    },
+    "@types/node": {
+      "version": "14.0.13",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.13.tgz",
+      "integrity": "sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA=="
+    },
     "@types/tmp": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.1.0.tgz",
@@ -27,6 +144,11 @@
       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
       "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
     },
+    "before-after-hook": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
+      "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
+    },
     "brace-expansion": {
       "version": "1.1.11",
       "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -41,11 +163,58 @@
       "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
       "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
     },
+    "cross-spawn": {
+      "version": "6.0.5",
+      "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+      "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+      "requires": {
+        "nice-try": "^1.0.4",
+        "path-key": "^2.0.1",
+        "semver": "^5.5.0",
+        "shebang-command": "^1.2.0",
+        "which": "^1.2.9"
+      }
+    },
+    "deprecation": {
+      "version": "2.3.1",
+      "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
+      "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
+    },
+    "end-of-stream": {
+      "version": "1.4.4",
+      "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+      "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+      "requires": {
+        "once": "^1.4.0"
+      }
+    },
+    "execa": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
+      "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+      "requires": {
+        "cross-spawn": "^6.0.0",
+        "get-stream": "^4.0.0",
+        "is-stream": "^1.1.0",
+        "npm-run-path": "^2.0.0",
+        "p-finally": "^1.0.0",
+        "signal-exit": "^3.0.0",
+        "strip-eof": "^1.0.0"
+      }
+    },
     "fs.realpath": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
       "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
     },
+    "get-stream": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+      "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+      "requires": {
+        "pump": "^3.0.0"
+      }
+    },
     "glob": {
       "version": "7.1.6",
       "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
@@ -73,6 +242,34 @@
       "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
       "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
     },
+    "is-plain-object": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz",
+      "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==",
+      "requires": {
+        "isobject": "^4.0.0"
+      }
+    },
+    "is-stream": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+      "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
+    },
+    "isexe": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+      "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
+    },
+    "isobject": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz",
+      "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA=="
+    },
+    "macos-release": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz",
+      "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA=="
+    },
     "minimatch": {
       "version": "3.0.4",
       "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@@ -81,6 +278,24 @@
         "brace-expansion": "^1.1.7"
       }
     },
+    "nice-try": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+      "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
+    },
+    "node-fetch": {
+      "version": "2.6.0",
+      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
+      "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
+    },
+    "npm-run-path": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+      "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+      "requires": {
+        "path-key": "^2.0.0"
+      }
+    },
     "once": {
       "version": "1.4.0",
       "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -89,11 +304,39 @@
         "wrappy": "1"
       }
     },
+    "os-name": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz",
+      "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==",
+      "requires": {
+        "macos-release": "^2.2.0",
+        "windows-release": "^3.1.0"
+      }
+    },
+    "p-finally": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+      "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
+    },
     "path-is-absolute": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
       "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
     },
+    "path-key": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+      "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
+    },
+    "pump": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+      "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+      "requires": {
+        "end-of-stream": "^1.1.0",
+        "once": "^1.3.1"
+      }
+    },
     "rimraf": {
       "version": "2.7.1",
       "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -102,6 +345,34 @@
         "glob": "^7.1.3"
       }
     },
+    "semver": {
+      "version": "5.7.1",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
+    },
+    "shebang-command": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+      "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+      "requires": {
+        "shebang-regex": "^1.0.0"
+      }
+    },
+    "shebang-regex": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+      "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
+    },
+    "signal-exit": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
+      "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
+    },
+    "strip-eof": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+      "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
+    },
     "tmp": {
       "version": "0.1.0",
       "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz",
@@ -129,6 +400,30 @@
       "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
       "dev": true
     },
+    "universal-user-agent": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz",
+      "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==",
+      "requires": {
+        "os-name": "^3.1.0"
+      }
+    },
+    "which": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+      "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+      "requires": {
+        "isexe": "^2.0.0"
+      }
+    },
+    "windows-release": {
+      "version": "3.3.1",
+      "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.1.tgz",
+      "integrity": "sha512-Pngk/RDCaI/DkuHPlGTdIkDiTAnAkyMjoQMZqRsxydNl1qGXNIoZrB7RK8g53F2tEgQBMqQJHQdYZuQEEAu54A==",
+      "requires": {
+        "execa": "^1.0.0"
+      }
+    },
     "wrappy": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
diff --git a/packages/artifact/package.json b/packages/artifact/package.json
index 42891a153a..b3a9de5c60 100644
--- a/packages/artifact/package.json
+++ b/packages/artifact/package.json
@@ -38,6 +38,7 @@
   },
   "dependencies": {
     "@actions/core": "^1.2.1",
+    "@actions/github": "^3.0.0",
     "@actions/http-client": "^1.0.7",
     "@types/tmp": "^0.1.0",
     "tmp": "^0.1.0",
diff --git a/packages/artifact/src/internal/artifact-client.ts b/packages/artifact/src/internal/artifact-client.ts
index 746a2e8a05..798f24b366 100644
--- a/packages/artifact/src/internal/artifact-client.ts
+++ b/packages/artifact/src/internal/artifact-client.ts
@@ -131,11 +131,24 @@ export class DefaultArtifactClient implements ArtifactClient {
   async downloadArtifact(
     name: string,
     path?: string | undefined,
-    options?: DownloadOptions | undefined
+    options?: DownloadOptions | undefined,
+    owner?: string,
+    repo?: string,
+    workflow?: string,
+    branch?: string
   ): Promise<DownloadResponse> {
     const downloadHttpClient = new DownloadHttpClient()
 
-    const artifacts = await downloadHttpClient.listArtifacts()
+    const artifacts =
+      owner || repo || workflow || branch
+        ? await downloadHttpClient.listArtifactsForWorkflowRun(
+            owner,
+            repo,
+            workflow,
+            branch
+          )
+        : await downloadHttpClient.listArtifacts()
+
     if (artifacts.count === 0) {
       throw new Error(
         `Unable to find any artifacts for the associated workflow`
@@ -193,12 +206,24 @@ export class DefaultArtifactClient implements ArtifactClient {
   }
 
   async downloadAllArtifacts(
-    path?: string | undefined
+    path?: string | undefined,
+    owner?: string,
+    repo?: string,
+    workflow?: string,
+    branch?: string
   ): Promise<DownloadResponse[]> {
     const downloadHttpClient = new DownloadHttpClient()
 
     const response: DownloadResponse[] = []
-    const artifacts = await downloadHttpClient.listArtifacts()
+    const artifacts =
+      owner || repo || workflow || branch
+        ? await downloadHttpClient.listArtifactsForWorkflowRun(
+            owner,
+            repo,
+            workflow,
+            branch
+          )
+        : await downloadHttpClient.listArtifacts()
     if (artifacts.count === 0) {
       core.info('Unable to find any artifacts for the associated workflow')
       return response
diff --git a/packages/artifact/src/internal/download-http-client.ts b/packages/artifact/src/internal/download-http-client.ts
index 4ddd76d5a1..7f0c73efe6 100644
--- a/packages/artifact/src/internal/download-http-client.ts
+++ b/packages/artifact/src/internal/download-http-client.ts
@@ -1,5 +1,6 @@
 import * as fs from 'fs'
 import * as core from '@actions/core'
+import * as github from '@actions/github'
 import * as zlib from 'zlib'
 import {
   getArtifactUrl,
@@ -14,11 +15,19 @@ import {
 import {URL} from 'url'
 import {StatusReporter} from './status-reporter'
 import {performance} from 'perf_hooks'
-import {ListArtifactsResponse, QueryArtifactResponse} from './contracts'
+import {
+  ListArtifactsResponse,
+  QueryArtifactResponse,
+  ArtifactResponse
+} from './contracts'
 import {IHttpClientResponse} from '@actions/http-client/interfaces'
 import {HttpManager} from './http-manager'
 import {DownloadItem} from './download-specification'
-import {getDownloadFileConcurrency, getRetryLimit} from './config-variables'
+import {
+  getDownloadFileConcurrency,
+  getRetryLimit,
+  getRuntimeToken
+} from './config-variables'
 import {IncomingHttpHeaders} from 'http'
 
 export class DownloadHttpClient {
@@ -53,6 +62,121 @@ export class DownloadHttpClient {
     )
   }
 
+  /**
+   * Gets the workflow ID matching the specified criteria.
+   *
+   * @param owner the owner of the repository that ran the workflow, defaults to owner of the repo running the current workflow
+   * @param repo the name of the repository that ran the workflow, defaults to name of the repo running the current workflow
+   * @param name the name of the workflow that ran, defaults to name of the current workflow
+   * @param branch the name of the branch that triggered the workflow, defaults to branch that triggered the current workflow
+   */
+  async listArtifactsForWorkflowRun(
+    owner: string = github.context.repo.owner,
+    repo: string = github.context.repo.repo,
+    name: string = github.context.workflow,
+    branch: string = github.context.ref
+  ): Promise<ListArtifactsResponse> {
+    const octokit = github.getOctokit(getRuntimeToken())
+
+    const workflowList = await octokit.actions.listRepoWorkflows({owner, repo})
+    if (
+      !isSuccessStatusCode(workflowList.status) ||
+      workflowList.data === undefined
+    ) {
+      throw new Error(
+        `Unable to list workflows for the repository. Resource Url ${workflowList.url}`
+      )
+    }
+
+    const workflow = workflowList.data.workflows.find(
+      element => element.name === name
+    )
+    if (!workflow) {
+      throw new Error(
+        `Unable to find workflow by name. Resource Url ${workflowList.url}`
+      )
+    }
+
+    const workflow_id = workflow.id
+    const workflowRuns = await octokit.actions.listWorkflowRuns({
+      owner,
+      repo,
+      workflow_id,
+      branch
+    })
+    if (
+      !isSuccessStatusCode(workflowRuns.status) ||
+      workflowRuns.data === undefined
+    ) {
+      throw new Error(
+        `Unable to list workflows runs. Resource Url ${workflowRuns.url}`
+      )
+    }
+
+    const workflowRun = workflowRuns.data.workflow_runs.find(
+      element =>
+        element.status === 'completed' && element.conclusion === 'success'
+    )
+    if (!workflowRun) {
+      throw new Error(
+        `Unable to find successfully completed workflow run. Resource Url ${workflowRuns.url}`
+      )
+    }
+
+    const run_id = workflowRun.id
+    const workflowRunArtifacts = await octokit.actions.listWorkflowRunArtifacts(
+      {
+        owner,
+        repo,
+        run_id
+      }
+    )
+
+    if (
+      !isSuccessStatusCode(workflowRunArtifacts.status) ||
+      workflowRunArtifacts.data === undefined
+    ) {
+      throw new Error(
+        `Unable to list workflows run artifacts. Resource Url ${workflowRuns.url}`
+      )
+    }
+
+    const returnValue: ArtifactResponse[] = await Promise.all(
+      workflowRunArtifacts.data.artifacts.map(async element => {
+        const download = await octokit.actions.downloadArtifact({
+          owner,
+          repo,
+          artifact_id: element.id,
+          archive_format: 'zip'
+        })
+
+        if (
+          !isSuccessStatusCode(download.status) ||
+          download.headers.location === undefined
+        ) {
+          throw new Error(
+            `Unable to get download URL for artifact. Resource Url ${download.url}`
+          )
+        }
+
+        return {
+          containerId: element.id.toString(),
+          fileContainerResourceUrl: '',
+          signedContent: '',
+          name: element.name,
+          size: element.size_in_bytes,
+          type: '',
+          url: download.headers.location
+        }
+      })
+    )
+
+    return {
+      count: workflowRunArtifacts.data.total_count,
+      value: returnValue
+    }
+  }
+
   /**
    * Fetches a set of container items that describe the contents of an artifact
    * @param artifactName the name of the artifact

From beb4c30c394be0d57d0b4361f168291e9eb5c169 Mon Sep 17 00:00:00 2001
From: Vaughan Nickerson <vaughan@greenlight.me>
Date: Fri, 9 Jul 2021 16:24:02 -0400
Subject: [PATCH 2/2] Update package/lock

---
 packages/artifact/package-lock.json | 290 +++++++++++++++++-----------
 packages/artifact/package.json      |   8 +-
 2 files changed, 184 insertions(+), 114 deletions(-)

diff --git a/packages/artifact/package-lock.json b/packages/artifact/package-lock.json
index 7d8140b4ab..25da74d894 100644
--- a/packages/artifact/package-lock.json
+++ b/packages/artifact/package-lock.json
@@ -1,18 +1,18 @@
 {
   "name": "@actions/artifact",
-  "version": "0.3.2",
+  "version": "0.5.2",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
     "@actions/core": {
-      "version": "1.2.4",
-      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
-      "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
+      "version": "1.2.6",
+      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
+      "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
     },
     "@actions/github": {
       "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/@actions/github/-/github-3.0.0.tgz",
-      "integrity": "sha512-zSYo0Pzh/AZt0DCBjCUhd9lNBECbbWnPqq5L32DZDTuEhjGJM8VSgOpKSol9climaJxhPJQhu+vUZIZuQi4Z1w==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@actions/github/-/github-3.0.0.tgz",
+      "integrity": "sha1-zhtyGiZq1axSLaDJwBPJmQCWBL8=",
       "requires": {
         "@actions/http-client": "^1.0.3",
         "@octokit/core": "^2.5.1",
@@ -21,25 +21,35 @@
       }
     },
     "@actions/http-client": {
-      "version": "1.0.8",
-      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz",
-      "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==",
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
+      "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
       "requires": {
         "tunnel": "0.0.6"
       }
     },
     "@octokit/auth-token": {
-      "version": "2.4.2",
-      "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz",
-      "integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==",
+      "version": "2.4.5",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/auth-token/-/auth-token-2.4.5.tgz",
+      "integrity": "sha1-VozPuMtG82RB+sCUzjT3qHWxl/M=",
       "requires": {
-        "@octokit/types": "^5.0.0"
+        "@octokit/types": "^6.0.3"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "6.18.1",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-6.18.1.tgz",
+          "integrity": "sha1-ptsXhTbmSf1dZ6e3R3VLzEOUC+Q=",
+          "requires": {
+            "@octokit/openapi-types": "^8.2.1"
+          }
+        }
       }
     },
     "@octokit/core": {
       "version": "2.5.4",
-      "resolved": "https://registry.npmjs.org/@octokit/core/-/core-2.5.4.tgz",
-      "integrity": "sha512-HCp8yKQfTITYK+Nd09MHzAlP1v3Ii/oCohv0/TW9rhSLvzb98BOVs2QmVYuloE6a3l6LsfyGIwb6Pc4ycgWlIQ==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/core/-/core-2.5.4.tgz",
+      "integrity": "sha1-9/v45PhsXMJJeoiHuiVh7I01gFQ=",
       "requires": {
         "@octokit/auth-token": "^2.4.0",
         "@octokit/graphql": "^4.3.1",
@@ -50,37 +60,82 @@
       }
     },
     "@octokit/endpoint": {
-      "version": "6.0.3",
-      "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.3.tgz",
-      "integrity": "sha512-Y900+r0gIz+cWp6ytnkibbD95ucEzDSKzlEnaWS52hbCDNcCJYO5mRmWW7HRAnDc7am+N/5Lnd8MppSaTYx1Yg==",
+      "version": "6.0.12",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/endpoint/-/endpoint-6.0.12.tgz",
+      "integrity": "sha1-O01HpLDnmxAn+4111CIZKLLQVlg=",
       "requires": {
-        "@octokit/types": "^5.0.0",
-        "is-plain-object": "^3.0.0",
-        "universal-user-agent": "^5.0.0"
+        "@octokit/types": "^6.0.3",
+        "is-plain-object": "^5.0.0",
+        "universal-user-agent": "^6.0.0"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "6.18.1",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-6.18.1.tgz",
+          "integrity": "sha1-ptsXhTbmSf1dZ6e3R3VLzEOUC+Q=",
+          "requires": {
+            "@octokit/openapi-types": "^8.2.1"
+          }
+        },
+        "universal-user-agent": {
+          "version": "6.0.0",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
+          "integrity": "sha1-M4H4UDslHA2c0hvB3pOeyd9UgO4="
+        }
       }
     },
     "@octokit/graphql": {
-      "version": "4.5.1",
-      "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.1.tgz",
-      "integrity": "sha512-qgMsROG9K2KxDs12CO3bySJaYoUu2aic90qpFrv7A8sEBzZ7UFGvdgPKiLw5gOPYEYbS0Xf8Tvf84tJutHPulQ==",
+      "version": "4.6.4",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/graphql/-/graphql-4.6.4.tgz",
+      "integrity": "sha1-DD9b7UQIIhgulyMXEirLZdMRpe0=",
       "requires": {
-        "@octokit/request": "^5.3.0",
-        "@octokit/types": "^5.0.0",
-        "universal-user-agent": "^5.0.0"
+        "@octokit/request": "^5.6.0",
+        "@octokit/types": "^6.0.3",
+        "universal-user-agent": "^6.0.0"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "6.18.1",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-6.18.1.tgz",
+          "integrity": "sha1-ptsXhTbmSf1dZ6e3R3VLzEOUC+Q=",
+          "requires": {
+            "@octokit/openapi-types": "^8.2.1"
+          }
+        },
+        "universal-user-agent": {
+          "version": "6.0.0",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
+          "integrity": "sha1-M4H4UDslHA2c0hvB3pOeyd9UgO4="
+        }
       }
     },
+    "@octokit/openapi-types": {
+      "version": "8.2.1",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/openapi-types/-/openapi-types-8.2.1.tgz",
+      "integrity": "sha1-EC51KnN4/40hBXxw/RbxyDhW2MU="
+    },
     "@octokit/plugin-paginate-rest": {
-      "version": "2.2.3",
-      "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.2.3.tgz",
-      "integrity": "sha512-eKTs91wXnJH8Yicwa30jz6DF50kAh7vkcqCQ9D7/tvBAP5KKkg6I2nNof8Mp/65G0Arjsb4QcOJcIEQY+rK1Rg==",
+      "version": "2.14.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.14.0.tgz",
+      "integrity": "sha1-9GnLSpCHkvtEZ5xZc9i7qCDIiw8=",
       "requires": {
-        "@octokit/types": "^5.0.0"
+        "@octokit/types": "^6.18.0"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "6.18.1",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-6.18.1.tgz",
+          "integrity": "sha1-ptsXhTbmSf1dZ6e3R3VLzEOUC+Q=",
+          "requires": {
+            "@octokit/openapi-types": "^8.2.1"
+          }
+        }
       }
     },
     "@octokit/plugin-rest-endpoint-methods": {
       "version": "3.17.0",
-      "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.17.0.tgz",
-      "integrity": "sha512-NFV3vq7GgoO2TrkyBRUOwflkfTYkFKS0tLAPym7RNpkwLCttqShaEGjthOsPEEL+7LFcYv3mU24+F2yVd3npmg==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.17.0.tgz",
+      "integrity": "sha1-2LoE64g4Sd2YZmxVv0nYyf574FU=",
       "requires": {
         "@octokit/types": "^4.1.6",
         "deprecation": "^2.3.1"
@@ -88,8 +143,8 @@
       "dependencies": {
         "@octokit/types": {
           "version": "4.1.10",
-          "resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.1.10.tgz",
-          "integrity": "sha512-/wbFy1cUIE5eICcg0wTKGXMlKSbaAxEr00qaBXzscLXpqhcwgXeS6P8O0pkysBhRfyjkKjJaYrvR1ExMO5eOXQ==",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-4.1.10.tgz",
+          "integrity": "sha1-5AKcEeLMEzUFF3W8FgDn50DkrKQ=",
           "requires": {
             "@types/node": ">= 8"
           }
@@ -97,42 +152,65 @@
       }
     },
     "@octokit/request": {
-      "version": "5.4.5",
-      "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.5.tgz",
-      "integrity": "sha512-atAs5GAGbZedvJXXdjtKljin+e2SltEs48B3naJjqWupYl2IUBbB/CJisyjbNHcKpHzb3E+OYEZ46G8eakXgQg==",
+      "version": "5.6.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/request/-/request-5.6.0.tgz",
+      "integrity": "sha1-YISGG25Poh3EDI4qc57F7/WX5nI=",
       "requires": {
         "@octokit/endpoint": "^6.0.1",
-        "@octokit/request-error": "^2.0.0",
-        "@octokit/types": "^5.0.0",
-        "deprecation": "^2.0.0",
-        "is-plain-object": "^3.0.0",
-        "node-fetch": "^2.3.0",
-        "once": "^1.4.0",
-        "universal-user-agent": "^5.0.0"
+        "@octokit/request-error": "^2.1.0",
+        "@octokit/types": "^6.16.1",
+        "is-plain-object": "^5.0.0",
+        "node-fetch": "^2.6.1",
+        "universal-user-agent": "^6.0.0"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "6.18.1",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-6.18.1.tgz",
+          "integrity": "sha1-ptsXhTbmSf1dZ6e3R3VLzEOUC+Q=",
+          "requires": {
+            "@octokit/openapi-types": "^8.2.1"
+          }
+        },
+        "universal-user-agent": {
+          "version": "6.0.0",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
+          "integrity": "sha1-M4H4UDslHA2c0hvB3pOeyd9UgO4="
+        }
       }
     },
     "@octokit/request-error": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz",
-      "integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==",
+      "version": "2.1.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/request-error/-/request-error-2.1.0.tgz",
+      "integrity": "sha1-nhUDV4Mb/HiNE6T9SxkT1gx01nc=",
       "requires": {
-        "@octokit/types": "^5.0.1",
+        "@octokit/types": "^6.0.3",
         "deprecation": "^2.0.0",
         "once": "^1.4.0"
+      },
+      "dependencies": {
+        "@octokit/types": {
+          "version": "6.18.1",
+          "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-6.18.1.tgz",
+          "integrity": "sha1-ptsXhTbmSf1dZ6e3R3VLzEOUC+Q=",
+          "requires": {
+            "@octokit/openapi-types": "^8.2.1"
+          }
+        }
       }
     },
     "@octokit/types": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.0.1.tgz",
-      "integrity": "sha512-GorvORVwp244fGKEt3cgt/P+M0MGy4xEDbckw+K5ojEezxyMDgCaYPKVct+/eWQfZXOT7uq0xRpmrl/+hliabA==",
+      "version": "5.5.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@octokit/types/-/types-5.5.0.tgz",
+      "integrity": "sha1-5fBujbISRsoQKqKERM2xOuF6E5s=",
       "requires": {
         "@types/node": ">= 8"
       }
     },
     "@types/node": {
-      "version": "14.0.13",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.13.tgz",
-      "integrity": "sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA=="
+      "version": "16.3.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/@types/node/-/node-16.3.0.tgz",
+      "integrity": "sha1-GDZmTk+tE7UbB+tuiCpTkl5lQ8Q="
     },
     "@types/tmp": {
       "version": "0.1.0",
@@ -145,9 +223,9 @@
       "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
     },
     "before-after-hook": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
-      "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
+      "version": "2.2.2",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/before-after-hook/-/before-after-hook-2.2.2.tgz",
+      "integrity": "sha1-pujKQQKNkO4sJCIvIByQlWCRYT4="
     },
     "brace-expansion": {
       "version": "1.1.11",
@@ -165,8 +243,8 @@
     },
     "cross-spawn": {
       "version": "6.0.5",
-      "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
-      "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/cross-spawn/-/cross-spawn-6.0.5.tgz",
+      "integrity": "sha1-Sl7Hxk364iw6FBJNus3uhG2Ay8Q=",
       "requires": {
         "nice-try": "^1.0.4",
         "path-key": "^2.0.1",
@@ -177,21 +255,21 @@
     },
     "deprecation": {
       "version": "2.3.1",
-      "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
-      "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/deprecation/-/deprecation-2.3.1.tgz",
+      "integrity": "sha1-Y2jL20Cr8zc7UlrIfkomDDpwCRk="
     },
     "end-of-stream": {
       "version": "1.4.4",
-      "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
-      "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/end-of-stream/-/end-of-stream-1.4.4.tgz",
+      "integrity": "sha1-WuZKX0UFe682JuwU2gyl5LJDHrA=",
       "requires": {
         "once": "^1.4.0"
       }
     },
     "execa": {
       "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
-      "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/execa/-/execa-1.0.0.tgz",
+      "integrity": "sha1-xiNqW7TfbW8V6I5/AXeYIWdJ3dg=",
       "requires": {
         "cross-spawn": "^6.0.0",
         "get-stream": "^4.0.0",
@@ -209,8 +287,8 @@
     },
     "get-stream": {
       "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
-      "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/get-stream/-/get-stream-4.1.0.tgz",
+      "integrity": "sha1-wbJVV189wh1Zv8ec09K0axw6VLU=",
       "requires": {
         "pump": "^3.0.0"
       }
@@ -243,32 +321,24 @@
       "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
     },
     "is-plain-object": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz",
-      "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==",
-      "requires": {
-        "isobject": "^4.0.0"
-      }
+      "version": "5.0.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/is-plain-object/-/is-plain-object-5.0.0.tgz",
+      "integrity": "sha1-RCf1CrNCnpAl6n1S6QQ6nvQVk0Q="
     },
     "is-stream": {
       "version": "1.1.0",
-      "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/is-stream/-/is-stream-1.1.0.tgz",
       "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
     },
     "isexe": {
       "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/isexe/-/isexe-2.0.0.tgz",
       "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
     },
-    "isobject": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz",
-      "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA=="
-    },
     "macos-release": {
-      "version": "2.3.0",
-      "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz",
-      "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA=="
+      "version": "2.5.0",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/macos-release/-/macos-release-2.5.0.tgz",
+      "integrity": "sha1-BnwsiLXz+zxWo3Wy7JOCYiD6H/I="
     },
     "minimatch": {
       "version": "3.0.4",
@@ -280,17 +350,17 @@
     },
     "nice-try": {
       "version": "1.0.5",
-      "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
-      "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/nice-try/-/nice-try-1.0.5.tgz",
+      "integrity": "sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y="
     },
     "node-fetch": {
-      "version": "2.6.0",
-      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
-      "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
+      "version": "2.6.1",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/node-fetch/-/node-fetch-2.6.1.tgz",
+      "integrity": "sha1-BFvTI2Mfdu0uK1VXM5RBa2OaAFI="
     },
     "npm-run-path": {
       "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/npm-run-path/-/npm-run-path-2.0.2.tgz",
       "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
       "requires": {
         "path-key": "^2.0.0"
@@ -306,8 +376,8 @@
     },
     "os-name": {
       "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz",
-      "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/os-name/-/os-name-3.1.0.tgz",
+      "integrity": "sha1-3sGdlmKW4c1i1wGlpm7h3ernCAE=",
       "requires": {
         "macos-release": "^2.2.0",
         "windows-release": "^3.1.0"
@@ -315,7 +385,7 @@
     },
     "p-finally": {
       "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/p-finally/-/p-finally-1.0.0.tgz",
       "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
     },
     "path-is-absolute": {
@@ -325,13 +395,13 @@
     },
     "path-key": {
       "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/path-key/-/path-key-2.0.1.tgz",
       "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
     },
     "pump": {
       "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
-      "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/pump/-/pump-3.0.0.tgz",
+      "integrity": "sha1-tKIRaBW94vTh6mAjVOjHVWUQemQ=",
       "requires": {
         "end-of-stream": "^1.1.0",
         "once": "^1.3.1"
@@ -347,12 +417,12 @@
     },
     "semver": {
       "version": "5.7.1",
-      "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
-      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/semver/-/semver-5.7.1.tgz",
+      "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc="
     },
     "shebang-command": {
       "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/shebang-command/-/shebang-command-1.2.0.tgz",
       "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
       "requires": {
         "shebang-regex": "^1.0.0"
@@ -360,17 +430,17 @@
     },
     "shebang-regex": {
       "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/shebang-regex/-/shebang-regex-1.0.0.tgz",
       "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
     },
     "signal-exit": {
       "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
-      "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/signal-exit/-/signal-exit-3.0.3.tgz",
+      "integrity": "sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw="
     },
     "strip-eof": {
       "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/strip-eof/-/strip-eof-1.0.0.tgz",
       "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
     },
     "tmp": {
@@ -402,24 +472,24 @@
     },
     "universal-user-agent": {
       "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz",
-      "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/universal-user-agent/-/universal-user-agent-5.0.0.tgz",
+      "integrity": "sha1-oxgqp1gGm/DnmVJXDKdX3jV5wdk=",
       "requires": {
         "os-name": "^3.1.0"
       }
     },
     "which": {
       "version": "1.3.1",
-      "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
-      "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/which/-/which-1.3.1.tgz",
+      "integrity": "sha1-pFBD1U9YBTFtqNYvn1CRjT2nCwo=",
       "requires": {
         "isexe": "^2.0.0"
       }
     },
     "windows-release": {
-      "version": "3.3.1",
-      "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.1.tgz",
-      "integrity": "sha512-Pngk/RDCaI/DkuHPlGTdIkDiTAnAkyMjoQMZqRsxydNl1qGXNIoZrB7RK8g53F2tEgQBMqQJHQdYZuQEEAu54A==",
+      "version": "3.3.3",
+      "resolved": "https://greenlight.jfrog.io/greenlight/api/npm/npm-combined/windows-release/-/windows-release-3.3.3.tgz",
+      "integrity": "sha1-HBACfHIldD7sa4nfFg1kwuApOZk=",
       "requires": {
         "execa": "^1.0.0"
       }
diff --git a/packages/artifact/package.json b/packages/artifact/package.json
index b3a9de5c60..ce2631e59a 100644
--- a/packages/artifact/package.json
+++ b/packages/artifact/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@actions/artifact",
-  "version": "0.3.2",
+  "version": "0.5.2",
   "preview": true,
   "description": "Actions artifact lib",
   "keywords": [
@@ -8,7 +8,7 @@
     "actions",
     "artifact"
   ],
-  "homepage": "https://github.com/actions/toolkit/tree/master/packages/artifact",
+  "homepage": "https://github.com/actions/toolkit/tree/main/packages/artifact",
   "license": "MIT",
   "main": "lib/artifact-client.js",
   "types": "lib/artifact-client.d.ts",
@@ -37,9 +37,9 @@
     "url": "https://github.com/actions/toolkit/issues"
   },
   "dependencies": {
-    "@actions/core": "^1.2.1",
+    "@actions/core": "^1.2.6",
     "@actions/github": "^3.0.0",
-    "@actions/http-client": "^1.0.7",
+    "@actions/http-client": "^1.0.11",
     "@types/tmp": "^0.1.0",
     "tmp": "^0.1.0",
     "tmp-promise": "^2.0.2"
