diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 95fd7d2..fae301f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 + - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 with: node-version-file: ".tool-versions" cache: "npm" diff --git a/README.md b/README.md index dd542e5..6e0622a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ jobs: uses: actions/checkout@v4 - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' ``` You can also use push config tag filter @@ -106,7 +106,7 @@ jobs: run: cat Release.txt - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' with: files: Release.txt ``` @@ -130,7 +130,7 @@ jobs: run: cat Release.txt - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' with: files: | Release.txt @@ -162,7 +162,7 @@ jobs: run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') + if: github.ref_type == 'tag' with: body_path: ${{ github.workspace }}-CHANGELOG.txt repository: my_gh_org/my_gh_repo diff --git a/action.yml b/action.yml index f9b5206..f2c291e 100644 --- a/action.yml +++ b/action.yml @@ -13,7 +13,7 @@ inputs: description: "Gives the release a custom name. Defaults to tag name" required: false tag_name: - description: "Gives a tag name. Defaults to github.GITHUB_REF" + description: "Gives a tag name. Defaults to github.ref_name" required: false draft: description: "Creates a draft release. Defaults to false" diff --git a/package-lock.json b/package-lock.json index 4462624..06e1838 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,8 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", - "@octokit/plugin-retry": "^7.1.4", - "@octokit/plugin-throttling": "^9.4.0", + "@octokit/plugin-retry": "^7.2.0", + "@octokit/plugin-throttling": "^9.6.1", "glob": "^11.0.1", "mime": "^3.0.0" }, @@ -19,14 +19,14 @@ "@types/glob": "^8.1.0", "@types/jest": "^29.5.14", "@types/mime": "^3.0.1", - "@types/node": "^22.13.10", + "@types/node": "^22.14.0", "@vercel/ncc": "^0.38.3", "jest": "^29.3.1", "jest-circus": "^29.3.1", "prettier": "3.5.3", - "ts-jest": "^29.2.6", + "ts-jest": "^29.3.1", "ts-node": "^10.9.2", - "typescript": "^5.8.2", + "typescript": "^5.8.3", "typescript-formatter": "^7.2.2" } }, @@ -84,9 +84,10 @@ } }, "node_modules/@actions/github/node_modules/@octokit/endpoint": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", - "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "license": "MIT", "dependencies": { "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" @@ -158,12 +159,13 @@ } }, "node_modules/@actions/github/node_modules/@octokit/request": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", - "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", + "license": "MIT", "dependencies": { - "@octokit/endpoint": "^9.0.1", - "@octokit/request-error": "^5.1.0", + "@octokit/endpoint": "^9.0.6", + "@octokit/request-error": "^5.1.1", "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" }, @@ -1321,9 +1323,10 @@ "peer": true }, "node_modules/@octokit/endpoint": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.2.tgz", - "integrity": "sha512-XybpFv9Ms4hX5OCHMZqyODYqGTZ3H6K6Vva+M9LR7ib/xr1y1ZnlChYv9H680y77Vd/i/k+thXApeRASBQkzhA==", + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.3.tgz", + "integrity": "sha512-nBRBMpKPhQUxCsQQeW+rCJ/OPSMcj3g0nfHn01zGYZXuNDvvXudF/TYY6APj5THlurerpFN4a/dQAIAaM6BYhA==", + "license": "MIT", "peer": true, "dependencies": { "@octokit/types": "^13.6.2", @@ -1337,6 +1340,7 @@ "version": "7.0.2", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz", "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==", + "license": "ISC", "peer": true }, "node_modules/@octokit/graphql": { @@ -1365,9 +1369,9 @@ "integrity": "sha512-izFjMJ1sir0jn0ldEKhZ7xegCTj/ObmEDlEfpFrx4k/JyZSMRHbO3/rBwgE7f3m2DHt+RrNGIVw4wSmwnm3t/g==" }, "node_modules/@octokit/plugin-retry": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.1.4.tgz", - "integrity": "sha512-7AIP4p9TttKN7ctygG4BtR7rrB0anZqoU9ThXFk8nETqIfvgPUANTSYHqWYknK7W3isw59LpZeLI8pcEwiJdRg==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-7.2.0.tgz", + "integrity": "sha512-psMbEYb/Fh+V+ZaFo8J16QiFz4sVTv3GntCSU+hYqzHiMdc3P+hhHLVv+dJt0PGIPAGoIA5u+J2DCJdK6lEPsQ==", "license": "MIT", "dependencies": { "@octokit/request-error": "^6.1.7", @@ -1382,9 +1386,10 @@ } }, "node_modules/@octokit/plugin-throttling": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.4.0.tgz", - "integrity": "sha512-IOlXxXhZA4Z3m0EEYtrrACkuHiArHLZ3CvqWwOez/pURNqRuwfoFlTPbN5Muf28pzFuztxPyiUiNwz8KctdZaQ==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-9.6.1.tgz", + "integrity": "sha512-bt3EBUkeKUzDQXRCcFrR9SWVqlLFRRqcCrr6uAorWt6NXTyjMKqcGrFmXqJy9NCbnKgiIZ2OXWq04theFc76Jg==", + "license": "MIT", "dependencies": { "@octokit/types": "^13.7.0", "bottleneck": "^2.15.3" @@ -1397,13 +1402,14 @@ } }, "node_modules/@octokit/request": { - "version": "9.1.4", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.1.4.tgz", - "integrity": "sha512-tMbOwGm6wDII6vygP3wUVqFTw3Aoo0FnVQyhihh8vVq12uO3P+vQZeo2CKMpWtPSogpACD0yyZAlVlQnjW71DA==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.2.tgz", + "integrity": "sha512-dZl0ZHx6gOQGcffgm1/Sf6JfEpmh34v3Af2Uci02vzUYz6qEN6zepoRtmybWXIGXFIK8K9ylE3b+duCWqhArtg==", + "license": "MIT", "peer": true, "dependencies": { - "@octokit/endpoint": "^10.0.0", - "@octokit/request-error": "^6.0.1", + "@octokit/endpoint": "^10.1.3", + "@octokit/request-error": "^6.1.7", "@octokit/types": "^13.6.2", "fast-content-type-parse": "^2.0.0", "universal-user-agent": "^7.0.2" @@ -1603,13 +1609,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.13.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz", - "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", + "version": "22.14.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.0.tgz", + "integrity": "sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.20.0" + "undici-types": "~6.21.0" } }, "node_modules/@types/stack-utils": { @@ -4386,9 +4392,9 @@ } }, "node_modules/ts-jest": { - "version": "29.2.6", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.6.tgz", - "integrity": "sha512-yTNZVZqc8lSixm+QGVFcPe6+yj7+TWZwIesuOWvfcn4B9bz5x4NDzVCQQjOs7Hfouu36aEqfEbo9Qpo+gq8dDg==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.3.1.tgz", + "integrity": "sha512-FT2PIRtZABwl6+ZCry8IY7JZ3xMuppsEV9qFVHOVe8jDzggwUZ9TsM4chyJxL9yi6LvkqcZYU3LmapEE454zBQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4400,6 +4406,7 @@ "lodash.memoize": "^4.1.2", "make-error": "^1.3.6", "semver": "^7.7.1", + "type-fest": "^4.38.0", "yargs-parser": "^21.1.1" }, "bin": { @@ -4447,6 +4454,19 @@ "node": ">=10" } }, + "node_modules/ts-jest/node_modules/type-fest": { + "version": "4.39.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.39.1.tgz", + "integrity": "sha512-uW9qzd66uyHYxwyVBYiwS4Oi0qZyUqwjU+Oevr6ZogYiXt99EOYtwvzMSLw1c3lYo2HzJsep/NB23iEVEgjG/w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -4520,9 +4540,9 @@ } }, "node_modules/typescript": { - "version": "5.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", - "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4565,10 +4585,11 @@ } }, "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", - "dev": true + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" }, "node_modules/universal-user-agent": { "version": "6.0.1", diff --git a/package.json b/package.json index 227a601..e71e05a 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", - "@octokit/plugin-retry": "^7.1.4", - "@octokit/plugin-throttling": "^9.4.0", + "@octokit/plugin-retry": "^7.2.0", + "@octokit/plugin-throttling": "^9.6.1", "glob": "^11.0.1", "mime": "^3.0.0" }, @@ -32,14 +32,14 @@ "@types/glob": "^8.1.0", "@types/jest": "^29.5.14", "@types/mime": "^3.0.1", - "@types/node": "^22.13.10", + "@types/node": "^22.14.0", "@vercel/ncc": "^0.38.3", "jest": "^29.3.1", "jest-circus": "^29.3.1", "prettier": "3.5.3", - "ts-jest": "^29.2.6", + "ts-jest": "^29.3.1", "ts-node": "^10.9.2", - "typescript": "^5.8.2", + "typescript": "^5.8.3", "typescript-formatter": "^7.2.2" } } diff --git a/src/github.ts b/src/github.ts index 990b291..a5ced28 100644 --- a/src/github.ts +++ b/src/github.ts @@ -228,18 +228,16 @@ export const release = async ( // you can't get an existing draft by tag // so we must find one in the list of all releases let _release: Release | undefined = undefined; - if (config.input_draft) { - _release = await findTagFromReleases(releaser, owner, repo, tag); - } else { - _release = ( - await releaser.getReleaseByTag({ - owner, - repo, - tag, - }) - ).data; + for await (const response of releaser.allReleases({ + owner, + repo, + })) { + _release = response.data.find((release) => release.tag_name === tag); + if (_release !== undefined) { + break; + } } - if (_release === null || _release === undefined) { + if (_release === undefined) { return await createRelease( tag, config,