diff --git a/README.md b/README.md index 64dd941..dad3d7e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ jobs: - name: Get release id: get_release - uses: bruceadams/get-release@v1.3.1 + uses: bruceadams/get-release@v1.3.2 env: GITHUB_TOKEN: ${{ github.token }} diff --git a/dist/index.js b/dist/index.js index 4330282..04fcff8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9511,12 +9511,13 @@ function wrappy (fn, cb) { /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const core = __nccwpck_require__(2186); -const { GitHub, context } = __nccwpck_require__(5438); +const github = __nccwpck_require__(5438); async function run() { try { + const context = github.context; // Get authenticated GitHub client (Ocktokit): https://github.com/actions/toolkit/tree/master/packages/github#usage - const github = new GitHub(process.env.GITHUB_TOKEN); + const octokit = github.getOctokit(process.env.GITHUB_TOKEN); // Get owner and repo from context of payload that triggered the action const { owner, repo } = context.repo; @@ -9530,7 +9531,7 @@ async function run() { // Get a release from the tag name // API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release // Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release - const getReleaseResponse = await github.repos.getReleaseByTag({ + const getReleaseResponse = await octokit.rest.repos.getReleaseByTag({ owner, repo, tag @@ -9562,7 +9563,6 @@ async function run() { module.exports = run; - /***/ }), /***/ 2877: diff --git a/src/get-release.js b/src/get-release.js index f369a67..da424bd 100644 --- a/src/get-release.js +++ b/src/get-release.js @@ -1,10 +1,11 @@ const core = require("@actions/core"); -const { GitHub, context } = require("@actions/github"); +const github = require('@actions/github'); async function run() { try { + const context = github.context; // Get authenticated GitHub client (Ocktokit): https://github.com/actions/toolkit/tree/master/packages/github#usage - const github = new GitHub(process.env.GITHUB_TOKEN); + const octokit = github.getOctokit(process.env.GITHUB_TOKEN); // Get owner and repo from context of payload that triggered the action const { owner, repo } = context.repo; @@ -18,7 +19,7 @@ async function run() { // Get a release from the tag name // API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release // Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release - const getReleaseResponse = await github.repos.getReleaseByTag({ + const getReleaseResponse = await octokit.rest.repos.getReleaseByTag({ owner, repo, tag @@ -48,4 +49,3 @@ async function run() { } module.exports = run; -