File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1313# Fetch optional environment variables
1414issue_labels = os .environ .get ('ISSUE_LABELS' )
1515issue_assignees = os .environ .get ('ISSUE_ASSIGNEES' )
16+ project_name = os .environ .get ('PROJECT_NAME' )
17+ project_column_name = os .environ .get ('PROJECT_COLUMN_NAME' )
1618
1719# If the file does not exist there is no issue to create
1820if not Path (issue_content_path ).is_file ():
4749 # Assign issue
4850 print ("Assigning issue to assignees" )
4951 issue .edit (assignees = assignees_list )
52+
53+ if project_name is not None and project_column_name is not None :
54+ # Locate the project by name
55+ project = None
56+ for project_item in repo .get_projects ("all" ):
57+ if project_item .name == project_name :
58+ project = project_item
59+ break
60+
61+ if not project :
62+ print ("Project not found" )
63+ exit (0 )
64+
65+ # Locate the column by name
66+ column = None
67+ for column_item in project .get_columns ():
68+ if column_item .name == project_column_name :
69+ column = column_item
70+ break
71+
72+ if not column :
73+ print ("Project column not found" )
74+ exit (0 )
75+
76+ # Add the issue to the project
77+ card = column .create_card (content_id = issue .id , content_type = "Issue" )
78+ print ("Added issue %d to project \" %s\" under column \" %s\" " \
79+ % (issue .number , project .name , column .name ))
You can’t perform that action at this time.
0 commit comments