Skip to content

Commit

Permalink
issue #165: repo_project list (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCardin authored Nov 22, 2024
1 parent c868ae3 commit 4e04a93
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/workflow-issue-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:

env:
OWNER: ai-cfia
REPO_PROJECT: github-workflows/repo_project.txt

jobs:
handle_issue_events:
Expand Down Expand Up @@ -59,12 +60,27 @@ jobs:
run: |
ISSUE_NUMBER="${ISSUE_NUMBER}"
OWNER="${OWNER}"
REPO_NAME="${{ github.repository }}"
FILE="${REPO_PROJECT}"
declare -A PROJECT_NUMBER_ID_MAP ITEM_ID_MAP STATUS_FIELD_ID_MAP STATUS_OPTIONS_MAP
echo "1. Project associated with this issue number #$ISSUE_NUMBER"
PROJECT_ITEMS_JSON=$(gh issue view "$ISSUE_NUMBER" --json projectItems)
if [ "$(echo "$PROJECT_ITEMS_JSON" | jq '.projectItems | length')" -eq 0 ]; then
echo "The projectItems list is empty. Assigning project from '$REPO_PROJECT'"
PROJECT=$(grep "^${REPO_NAME}_" "$FILE" | cut -d'_' -f2)
if [ -n "$PROJECT" ]; then
gh issue edit "$ISSUE_NUMBER" --add-project "$PROJECT"
PROJECT_ITEMS_JSON=$(gh issue view "$ISSUE_NUMBER" --json projectItems)
echo "Assigned project $PROJECT to issue $ISSUE_NUMBER."
else
echo "No matching project found for repository $REPO_NAME."
fi
fi
PROJECT_TITLES=$(echo "$PROJECT_ITEMS_JSON" | jq -r '.projectItems[].title')
echo "$PROJECT_TITLES"
Expand Down
12 changes: 12 additions & 0 deletions repo_project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fertiscan-backend_FertiScan
fertiscan-frontend_FertiScan
fertiscan-pipeline_FertiScan
nachet-backend_Nachet
nachet-frontend_Nachet
nachet-model_Nachet
howard_DevSecOps
github-workflows_DevSecOps
devops_DevSecOps
finesse-backend_Finesse
finesse-frontend_Finesse
finesse-data_Finesse

0 comments on commit 4e04a93

Please sign in to comment.