diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 31eebb9d..76c482ba 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: fetch-depth: 1 - uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 16 - run: yarn - run: yarn lint @@ -27,7 +27,7 @@ jobs: fetch-depth: 1 - uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 16 registry-url: https://registry.npmjs.org/ - run: yarn @@ -35,3 +35,5 @@ jobs: - run: yarn semantic-release env: GH_TOKEN: ${{secrets.GH_TOKEN}} + NPM_TOKEN: ${{secrets.NPM_TOKEN}} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/CHANGELOG.md b/CHANGELOG.md index fd26cb31..a4cbb5dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [2.1.0](https://github.com/kamranayub/wait-for-netlify-action/compare/v2.0.3...v2.1.0) (2022-10-21) + + +### Features + +* query *all* sites and match on exact site name ([#7](https://github.com/kamranayub/wait-for-netlify-action/issues/7)) ([40462bd](https://github.com/kamranayub/wait-for-netlify-action/commit/40462bd43a592d2926663e1e539f3751f768a1d9)) + ## [2.0.3](https://github.com/kamranayub/wait-for-netlify-action/compare/v2.0.2...v2.0.3) (2020-07-31) diff --git a/action.yml b/action.yml index cab75435..4fb36824 100644 --- a/action.yml +++ b/action.yml @@ -14,5 +14,5 @@ outputs: url: description: "The fully qualified deploy preview URL" runs: - using: "node12" + using: "node16" main: "dist/index.js" diff --git a/index.js b/index.js index e74f4fe7..0bef2346 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,7 @@ const waitForUrl = async (url, MAX_TIMEOUT) => { for (let i = 0; i < iterations; i += 1) { try { await axios.get(url); + console.log('Url fetch completed, done!'); return; } catch (e) { console.log('Url unavailable, retrying...'); @@ -49,11 +50,13 @@ const run = async () => { core.setFailed('Required field `site_name` was not provided'); } - const { data: netlifySites } = await getNetlifyUrl(`https://api.netlify.com/api/v1/sites?name=${siteName}`); + const { data: netlifySites } = await getNetlifyUrl( + `https://api.netlify.com/api/v1/sites?filter=all&name=${siteName}`, + ); if (!netlifySites || netlifySites.length === 0) { core.setFailed(`Could not find Netlify site with the name ${siteName}`); } - const { site_id: siteId } = netlifySites[0]; + const { site_id: siteId } = netlifySites.find((site) => site.name === siteName); core.setOutput('site_id', siteId); const { data: netlifyDeployments } = await getNetlifyUrl(`https://api.netlify.com/api/v1/sites/${siteId}/deploys`); diff --git a/package.json b/package.json index f5418e77..e0521414 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ }, "license": "ISC", "dependencies": { - "@actions/core": "1.2.4", + "@actions/core": "^1.10.0", "@actions/github": "^4.0.0", "axios": "0.19.2" }, diff --git a/yarn.lock b/yarn.lock index 9f8fb194..30868359 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,13 @@ # yarn lockfile v1 -"@actions/core@1.2.4": - version "1.2.4" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab" - integrity sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg== +"@actions/core@^1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" + integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug== + dependencies: + "@actions/http-client" "^2.0.1" + uuid "^8.3.2" "@actions/github@^4.0.0": version "4.0.0" @@ -24,6 +27,13 @@ dependencies: tunnel "0.0.6" +"@actions/http-client@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.1.tgz#873f4ca98fe32f6839462a6f046332677322f99c" + integrity sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw== + dependencies: + tunnel "^0.0.6" + "@babel/code-frame@^7.0.0": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" @@ -5411,7 +5421,7 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tunnel@0.0.6: +tunnel@0.0.6, tunnel@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== @@ -5585,6 +5595,11 @@ uuid@^3.3.2, uuid@^3.3.3: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + v8-compile-cache@^2.0.3: version "2.1.1" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"