Skip to content

Commit

Permalink
Fix action not running for a card that exists in multiple projects (#20)
Browse files Browse the repository at this point in the history
Co-Authored-By: pomu0325 <pomu0325@gmail.com>

Co-authored-by: Pomu <pomu0325@gmail.com>
  • Loading branch information
Alex Page and pomu0325 authored Jan 15, 2020
1 parent 028fe99 commit 9a05133
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ GraphqlError: Resource protected by organization SAML enforcement. You must gran
## Release History
- v0.1.2 - Fix action not running for a card that exists in multiple projects
- v0.1.1 - Document type filter so action runs once
- v0.1.0 - Add support for user projects
- v0.0.3 - Automatic build before commit
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const getData = () => {
projectCards {
nodes {
id
project {
name
}
}
}
repository {
Expand Down Expand Up @@ -87,10 +90,9 @@ const getData = () => {
[];
});

const cardId = (resource.projectCards.nodes &&
resource.projectCards.nodes[0] &&
resource.projectCards.nodes[0].id) ||
null;
const cards = resource.projectCards.nodes ?
resource.projectCards.nodes.filter(card => card.project.name === project) : [];
const cardId = cards.length > 0 ? cards[0].id : null;

if (columns.length === 0) {
throw new Error(`Could not find ${column} in ${project}`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-project-automation-plus",
"version": "0.1.1",
"version": "0.1.2",
"description": "🤖 Automate GitHub Project cards with any webhook event",
"private": true,
"main": "dist/index.js",
Expand Down

0 comments on commit 9a05133

Please sign in to comment.