Skip to content

Commit

Permalink
🐛 Use getProperties again
Browse files Browse the repository at this point in the history
  • Loading branch information
blombard committed Sep 25, 2024
1 parent 09dbd2d commit 10cd47c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29651,11 +29651,13 @@ const run = async () => {
const coreExclusedStatuses = core.getInput("excluded-statuses");
const excludedStatuses = coreExclusedStatuses ? coreExclusedStatuses.split(",") : [];

const project = new GitHubProject({ owner, number, token });
const ghProject = new GitHubProject({ owner, number, token, fields: { iteration: iterationField } });

const items = await project.items.list();
const items = await ghProject.items.list();
core.debug(`items: ${JSON.stringify(items)}`);

const project = await ghProject.getProperties();

if (!project.fields) {
core.setFailed(`No iteration field found with name ${iterationField}`);
return;
Expand Down Expand Up @@ -29702,7 +29704,7 @@ const run = async () => {
});

await Promise.all(
filteredItems.map((item) => project.items.update(item.id, { iteration: newIteration.title }))
filteredItems.map((item) => ghProject.items.update(item.id, { iteration: newIteration.title }))
);
} catch (error) {
core.setFailed(error);
Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ const run = async () => {
const coreExclusedStatuses = core.getInput("excluded-statuses");
const excludedStatuses = coreExclusedStatuses ? coreExclusedStatuses.split(",") : [];

const project = new GitHubProject({ owner, number, token });
const ghProject = new GitHubProject({ owner, number, token, fields: { iteration: iterationField } });

const items = await project.items.list();
const items = await ghProject.items.list();
core.debug(`items: ${JSON.stringify(items)}`);

const project = await ghProject.getProperties();

if (!project.fields) {
core.setFailed(`No iteration field found with name ${iterationField}`);
return;
Expand Down Expand Up @@ -64,7 +66,7 @@ const run = async () => {
});

await Promise.all(
filteredItems.map((item) => project.items.update(item.id, { iteration: newIteration.title }))
filteredItems.map((item) => ghProject.items.update(item.id, { iteration: newIteration.title }))
);
} catch (error) {
core.setFailed(error);
Expand Down

0 comments on commit 10cd47c

Please sign in to comment.