Skip to content

Commit c81d34c

Browse files
pomu0325Alex Page
andcommitted
filter projectCards within the same project (#16)
* Fix action not running for a card that exists in multiple projects Co-authored-by: Alex Page <[email protected]>
1 parent 028fe99 commit c81d34c

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ GraphqlError: Resource protected by organization SAML enforcement. You must gran
9494
9595
## Release History
9696
97+
- v0.1.2 - Fix action not running for a card that exists in multiple projects
9798
- v0.1.1 - Document type filter so action runs once
9899
- v0.1.0 - Add support for user projects
99100
- v0.0.3 - Automatic build before commit

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ const getData = () => {
3636
projectCards {
3737
nodes {
3838
id
39+
project {
40+
name
41+
}
3942
}
4043
}
4144
repository {
@@ -87,10 +90,9 @@ const getData = () => {
8790
[];
8891
});
8992

90-
const cardId = (resource.projectCards.nodes &&
91-
resource.projectCards.nodes[0] &&
92-
resource.projectCards.nodes[0].id) ||
93-
null;
93+
const cards = resource.projectCards.nodes ?
94+
resource.projectCards.nodes.filter(card => card.project.name === project) : [];
95+
const cardId = cards.length > 0 ? cards[0].id : null;
9496

9597
if (columns.length === 0) {
9698
throw new Error(`Could not find ${column} in ${project}`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-project-automation-plus",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "🤖 Automate GitHub Project cards with any webhook event",
55
"private": true,
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)