Skip to content

Commit

Permalink
debug getAllPackageVersionsForPackageOwnedByOrg
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmauro committed Oct 27, 2022
1 parent c97e116 commit 0bfd2cb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
12 changes: 11 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,23 @@ function run() {
core.info('Checking for existing tagged container package');
let packageId = 0;
for (let page = 1; packageId == 0 && page <= 20; page += 1) {
core.info('page:' + page.toString());
try {
core.info(JSON.stringify({
package_type: 'container',
package_name: repo,
org: owner,
page,
per_page: 100,
//state: 'active'
}));
const packagesInfo = yield octokit.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
package_type: 'container',
package_name: repo,
org: owner,
page,
per_page: 100,
state: 'active'
//state: 'active'
});
if (packagesInfo.status !== 200) {
throw new Error('Failed to retrieve the list of images');
Expand Down Expand Up @@ -231,6 +240,7 @@ function run() {
}
catch (err) {
// Handle release not found error
core.info('ERROR:' + JSON.stringify(err));
if (err.status !== 404 && err.message !== 'Not Found') {
throw err;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dockerbuildandpush-action",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"description": "GitHub action to build and push a docker image into GitHub Container registry",
"main": "lib/main.js",
Expand Down
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,23 @@ async function run(): Promise<void> {
core.info('Checking for existing tagged container package');
let packageId = 0;
for (let page = 1; packageId == 0 && page <= 20; page += 1) {
core.info('page:' + page.toString());
try {
core.info(JSON.stringify({
package_type: 'container',
package_name: repo,
org: owner,
page,
per_page: 100,
//state: 'active'
}));
const packagesInfo = await octokit.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
package_type: 'container',
package_name: repo,
org: owner,
page,
per_page: 100,
state: 'active'
//state: 'active'
});
if (packagesInfo.status !== 200) {
throw new Error('Failed to retrieve the list of images');
Expand Down Expand Up @@ -211,6 +220,7 @@ async function run(): Promise<void> {
}
catch (err: any) {
// Handle release not found error
core.info('ERROR:' + JSON.stringify(err));
if (err.status !== 404 && err.message !== 'Not Found') {
throw err;
}
Expand Down

0 comments on commit 0bfd2cb

Please sign in to comment.