Skip to content

Commit ab14925

Browse files
authored
Merge branch 'master' into master
2 parents d51271f + ca34336 commit ab14925

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

.github/actions/add_pr_to_smackore_board/action.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Add PR to Smackore board, if author is from community'
2-
description: '(disabled due to github-side bug) Adds PR to "New issues by community" column in Smackore project board, if PR author is from outside Membrane Team.'
2+
description: 'Adds PR to "New issues by community" column in Smackore project board, if PR author is from outside Membrane Team.'
33
inputs:
44
GITHUB_TOKEN:
55
description: 'GitHub token'
@@ -19,23 +19,23 @@ runs:
1919
repository: membraneframework/membrane_core
2020
- name: Maybe add PR to board and set ticket status
2121
run: |
22-
# currently this causes github action crash, more info here: https://github.com/membraneframework/membrane_core/issues/749
23-
24-
# export PROJECT_NUMBER=19
25-
# export PROJECT_ID=PVT_kwDOAYE_z84AWEIB
26-
# export STATUS_FIELD_ID=PVTSSF_lADOAYE_z84AWEIBzgOGd1k
27-
# export TARGET_COLUMN_ID=e6b1ee10
22+
# currently this may cause github action crash, more info here: https://github.com/membraneframework/membrane_core/issues/749
23+
24+
export PROJECT_NUMBER=19
25+
export PROJECT_ID=PVT_kwDOAYE_z84AWEIB
26+
export STATUS_FIELD_ID=PVTSSF_lADOAYE_z84AWEIBzgOGd1k
27+
export TARGET_COLUMN_ID=e6b1ee10
2828
29-
# export AUTHOR_ORIGIN=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/membraneframework/teams/membraneteam/members | python scripts/python/get_author_origin.py $AUTHOR_LOGIN)
29+
export AUTHOR_ORIGIN=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/membraneframework/teams/membraneteam/members | python scripts/python/get_author_origin.py $AUTHOR_LOGIN)
3030
31-
# if [ "$AUTHOR_ORIGIN" == "COMMUNITY" ]
32-
# then
33-
# gh pr edit "$PR_URL" --add-project Smackore
34-
# sleep 10
31+
if [ "$AUTHOR_ORIGIN" == "COMMUNITY" ]
32+
then
33+
gh pr edit "$PR_URL" --add-project Smackore
34+
sleep 10
3535
36-
# export TICKET_ID=$(gh project item-list $PROJECT_NUMBER --owner membraneframework --format json --limit 10000000 | python scripts/python/get_ticket_id.py "$PR_URL")
37-
# gh project item-edit --id $TICKET_ID --field-id $STATUS_FIELD_ID --project-id $PROJECT_ID --single-select-option-id $TARGET_COLUMN_ID
38-
# fi
36+
export TICKET_ID=$(gh project item-list $PROJECT_NUMBER --owner membraneframework --format json --limit 10000000 | python scripts/python/get_ticket_id.py "$PR_URL")
37+
gh project item-edit --id $TICKET_ID --field-id $STATUS_FIELD_ID --project-id $PROJECT_ID --single-select-option-id $TARGET_COLUMN_ID
38+
fi
3939
4040
env:
4141
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}

scripts/python/get_author_origin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
print("COMMUNITY")
1717
except:
18-
print("An exception occurred, provided JSON:")
19-
print(membrane_team)
20-
print("provided PR_AUTHOR:", pr_author)
18+
print("An exception occurred in get_author_origin.py, provided JSON: ", membrane_team)
19+
print("Provided PR_AUTHOR: ", pr_author)
20+
sys.exit(1)

scripts/python/get_ticket_id.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
full_json = json.load(sys.stdin)
44
pr_url = sys.argv[1]
55

6-
try:
7-
project_items = full_json["items"]
8-
[id] = [item["id"] for item in project_items if ("url" in item["content"] and item["content"]["url"] == pr_url)]
9-
print(id)
10-
except:
11-
print("An exception occurred, provided JSON:")
12-
print(full_json)
13-
print("provided PR_URL:", pr_url)
6+
project_items = full_json["items"]
7+
8+
item_id = None
9+
for item in project_items:
10+
if "content" in item and "url" in item["content"]:
11+
if item["content"]["url"] == pr_url:
12+
item_id = item["id"]
13+
break
14+
15+
if item_id == None:
16+
print("Error occurred in get_ticket.py: ID of ticket related to PR", pr_url, "not found in the provided JSON")
17+
print("Provided JSON:", full_json)
18+
sys.exit(1)
19+
else:
20+
print(item_id)

0 commit comments

Comments
 (0)