Skip to content

Commit 74c3d60

Browse files
committed
Adjust code to newer @actions/github
1 parent 439b858 commit 74c3d60

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Get release
4040
id: get_release
41-
uses: bruceadams/get-release@v1.3.1
41+
uses: bruceadams/get-release@v1.3.2
4242
env:
4343
GITHUB_TOKEN: ${{ github.token }}
4444

dist/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9511,12 +9511,13 @@ function wrappy (fn, cb) {
95119511
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
95129512

95139513
const core = __nccwpck_require__(2186);
9514-
const { GitHub, context } = __nccwpck_require__(5438);
9514+
const github = __nccwpck_require__(5438);
95159515

95169516
async function run() {
95179517
try {
9518+
const context = github.context;
95189519
// Get authenticated GitHub client (Ocktokit): https://github.com/actions/toolkit/tree/master/packages/github#usage
9519-
const github = new GitHub(process.env.GITHUB_TOKEN);
9520+
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
95209521

95219522
// Get owner and repo from context of payload that triggered the action
95229523
const { owner, repo } = context.repo;
@@ -9530,7 +9531,7 @@ async function run() {
95309531
// Get a release from the tag name
95319532
// API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release
95329533
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release
9533-
const getReleaseResponse = await github.repos.getReleaseByTag({
9534+
const getReleaseResponse = await octokit.rest.repos.getReleaseByTag({
95349535
owner,
95359536
repo,
95369537
tag
@@ -9562,7 +9563,6 @@ async function run() {
95629563
module.exports = run;
95639564

95649565

9565-
95669566
/***/ }),
95679567

95689568
/***/ 2877:

src/get-release.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
const core = require("@actions/core");
2-
const { GitHub, context } = require("@actions/github");
2+
const github = require('@actions/github');
33

44
async function run() {
55
try {
6+
const context = github.context;
67
// Get authenticated GitHub client (Ocktokit): https://github.com/actions/toolkit/tree/master/packages/github#usage
7-
const github = new GitHub(process.env.GITHUB_TOKEN);
8+
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
89

910
// Get owner and repo from context of payload that triggered the action
1011
const { owner, repo } = context.repo;
@@ -18,7 +19,7 @@ async function run() {
1819
// Get a release from the tag name
1920
// API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release
2021
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release
21-
const getReleaseResponse = await github.repos.getReleaseByTag({
22+
const getReleaseResponse = await octokit.rest.repos.getReleaseByTag({
2223
owner,
2324
repo,
2425
tag
@@ -48,4 +49,3 @@ async function run() {
4849
}
4950

5051
module.exports = run;
51-

0 commit comments

Comments
 (0)