Skip to content

Commit

Permalink
Adjust code to newer @actions/github
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceadams committed Oct 25, 2022
1 parent 439b858 commit 74c3d60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: Get release
id: get_release
uses: bruceadams/[email protected].1
uses: bruceadams/[email protected].2
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
8 changes: 4 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -9562,7 +9563,6 @@ async function run() {
module.exports = run;



/***/ }),

/***/ 2877:
Expand Down
8 changes: 4 additions & 4 deletions src/get-release.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -48,4 +49,3 @@ async function run() {
}

module.exports = run;

0 comments on commit 74c3d60

Please sign in to comment.