1+
2+ # This GitHub Actions workflow generates an assessment Excel file for SIMATIC AX projects
3+ # and automatically creates an issue with download links and notification emails.
4+ #
5+ # Workflow Structure:
6+ # 1. collect-info: Gathers project information and creates info.yml artifact
7+ # 2. fill-excel: Downloads info, generates Excel file, and uploads as artifact
8+ # 3. notify: Creates GitHub issue with download links and email notification
9+ #
10+ # The workflow is triggered manually via workflow_dispatch with two required inputs:
11+ # - EXACT_Ticket_ID: The EX Classification Ticket number
12+ # - Approver: The business approver (Promotor BL) selected from predefined options
13+ #
14+ # Artifacts generated:
15+ # - info-yml: Contains collected project information
16+ # - assessment-excel: The generated questionnaire Excel file
17+ #
18+ # The final issue includes direct links to the workflow run for artifact download
19+ # and a mailto link for email notification to the actor.
20+
21+ name : Start Assessment
22+ on :
23+ workflow_dispatch :
24+ inputs :
25+ EXACT_Ticket_ID :
26+ description : ' Your EX Classification Ticket'
27+ required : true
28+ default : ' 0000'
29+ Approver :
30+ description : ' Promotor BL (Approver from Business Side to release)'
31+ required : true
32+ type : string
33+
34+ jobs :
35+ # Job 1: Collect project information and create info.yml artifact
36+ # Uses simatic-ax internal action to gather project details, ticket info, and approver data
37+ collect-info :
38+ runs-on : ubuntu-latest
39+ steps :
40+ # Checkout the repository to access project files
41+ - name : Checkout repository
42+ uses : actions/checkout@v4
43+
44+ # Set up Python environment for the collection script
45+ - name : Set up Python
46+ uses : actions/setup-python@v4
47+ with :
48+ python-version : ' 3.x'
49+
50+ # Install required Python dependencies for info collection
51+ - name : Install Python dependencies
52+ run : |
53+ python3 -m pip install requests pyyaml openpyxl
54+
55+ # Collect project information using internal Simatic AX action
56+ # This creates an info.yml file with project details, ticket ID, and approver
57+ - name : Collect Info
58+ uses : simatic-ax/internal-actions/collect-assessment-information@v1
59+ with :
60+ project_name : ${{ github.repository }}
61+ username : ${{ github.actor }}
62+ token : ${{ secrets.READ_USER_TOKEN }}
63+ ticket_id : ${{ inputs.EXACT_Ticket_ID }}
64+ approver : ${{ inputs.Approver }}
65+
66+ # Upload the generated info.yml as an artifact for use in subsequent jobs
67+ - name : Upload info.yml
68+ uses : actions/upload-artifact@v3
69+ with :
70+ name : info-yml
71+ path : info.yml
72+
73+ # Job 2: Generate the assessment Excel file using the collected information
74+ # Downloads info.yml artifact and creates the questionnaire Excel file
75+ fill-excel :
76+ runs-on : ubuntu-latest
77+ needs : collect-info # Wait for info collection to complete
78+ steps :
79+ # Checkout repository for Excel generation scripts
80+ - name : Checkout repository
81+ uses : actions/checkout@v4
82+
83+ # Set up Python environment for Excel generation
84+ - name : Set up Python
85+ uses : actions/setup-python@v4
86+ with :
87+ python-version : ' 3.x'
88+
89+ # Install Python dependencies required for Excel file creation
90+ - name : Install Python dependencies
91+ run : |
92+ python3 -m pip install requests pyyaml openpyxl
93+
94+ # Download the info.yml artifact created in the previous job
95+ - name : Download info.yml
96+ uses : actions/download-artifact@v3
97+ with :
98+ name : info-yml
99+
100+ # Generate the assessment Excel file using internal Simatic AX action
101+ # This creates a Questionnaire_Contribution_*.xlsx file
102+ - name : Create Assessment Excel-File
103+ uses : simatic-ax/internal-actions/create-assessment-excel@v1
104+
105+ # Upload the generated Excel file as an artifact for download
106+ - name : Upload Excel artifact
107+ uses : actions/upload-artifact@v3
108+ with :
109+ name : assessment-excel
110+ path : Questionnaire_Contribution_*.xlsx
111+
112+ # Print workflow run information for reference
113+ # Note: Artifacts are only available via API after complete workflow finish
114+ - name : Print Run ID after Excel artifact upload
115+ run : |
116+ echo "Aktuelle Run ID: ${{ github.run_id }}"
117+ echo "Excel artifact wird nach Workflow-Ende verfügbar sein unter:"
118+ echo "https://github.siemens.cloud/${{ github.repository }}/actions/runs/${{ github.run_id }}"
119+
120+ # Job 4: Trigger notification workflow with direct artifact links
121+ # This job calls the separate notify-assessment workflow to create detailed issues with artifact download links
122+ trigger-notify :
123+ runs-on : ubuntu-latest
124+ needs : fill-excel # Wait for notify to complete
125+ steps :
126+ # Download info.yml to extract ticket information for notification
127+ - name : Download info.yml
128+ uses : actions/download-artifact@v3
129+ with :
130+ name : info-yml
131+
132+ # Extract ticket ID and email for notification content
133+ - name : Extract notification info
134+ id : extract-info
135+ run : |
136+ SCD_MAIL=$(cat info.yml | grep scd_mail | awk '{print $2}')
137+ TICKET_ID=$(cat info.yml | grep ticket_id | awk '{print $2}')
138+ echo "scd_mail=$SCD_MAIL" >> $GITHUB_OUTPUT
139+ echo "ticket_id=$TICKET_ID" >> $GITHUB_OUTPUT
140+
141+ # Trigger the separate notification workflow with direct artifact links
142+ - name : Trigger notification workflow
143+ run : |
144+ ISSUE_TITLE="Assessment Excel Ready - Direct Downloads (Ticket: ${{ steps.extract-info.outputs.ticket_id }})"
145+ ISSUE_BODY="🎯 **Assessment Excel Generation Complete**\n\nTicket ID: **${{ steps.extract-info.outputs.ticket_id }}**\nTriggered by: **${{ github.actor }}**\n\n📧 **Quick Email Notification:**\n[Send email to ${{ steps.extract-info.outputs.scd_mail }}](mailto:${{ steps.extract-info.outputs.scd_mail }}?subject=Assessment%20Excel%20Ready%20-%20Ticket%20${{ steps.extract-info.outputs.ticket_id }}&body=Hello,%0A%0AYour%20assessment%20Excel%20file%20has%20been%20generated%20successfully.%0A%0ATicket:%20${{ steps.extract-info.outputs.ticket_id }}%0AWorkflow%20Run:%20https://github.siemens.cloud/${{ github.repository }}/actions/runs/${{ github.run_id }}%0A%0APlease%20check%20the%20GitHub%20issue%20for%20direct%20download%20links.%0A%0ABest%20regards)"
146+
147+ curl -X POST \
148+ -H "Authorization: token ${{ secrets.GH_ISSUE_CREATOR_TOKEN }}" \
149+ -H "Accept: application/vnd.github.v3+json" \
150+ "https://github.siemens.cloud/api/v3/repos/${{ github.repository }}/actions/workflows/notify-assessment.yml/dispatches" \
151+ -d "{
152+ \"ref\": \"main\",
153+ \"inputs\": {
154+ \"run_id\": \"${{ github.run_id }}\",
155+ \"repository\": \"${{ github.repository }}\",
156+ \"actor\": \"${{ github.actor }}\"
157+ }
158+ }"
0 commit comments