Run Draw Script and Upload Artifacts #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Draw Script and Upload Artifacts | |
| on: | |
| push: | |
| branches: | |
| - main # 當 push 到 main 分支時觸發 | |
| workflow_dispatch: | |
| inputs: | |
| name_list: # 輸入參數的名稱 | |
| description: 'Comma-separated list of names to draw' | |
| required: true | |
| default: 'chia7712' # 預設多個字串 | |
| jobs: | |
| build-and-draw: | |
| runs-on: ubuntu-latest # 使用最新的 Ubuntu 執行器 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: chia7712/clip # 替換成你要下載的 repo 名稱 | |
| path: my-downloaded-repo # 下載的 repo 將會被放在這個目錄下 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' # 選擇一個你 draw.py 支援的 Python 版本 | |
| # 如果你的 draw.py 需要安裝額外的 Python 函式庫,請取消註解下面這段 | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pandas matplotlib seaborn | |
| working-directory: ./my-downloaded-repo | |
| - name: copy stats | |
| run: | | |
| python copy_stats.py -s "${{ github.event.inputs.name_list }}" -f kafka | |
| cp -r kafka/commit_stats ./ | |
| working-directory: ./my-downloaded-repo/github # 確保在下載的 repo 目錄下執行程式 | |
| - name: Execute draw.py | |
| run: python draw.py | |
| working-directory: ./my-downloaded-repo/github # 確保在下載的 repo 目錄下執行程式 | |
| - name: Upload generated images | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: generated-images # artifacts 的名稱 | |
| path: my-downloaded-repo/github/all_users_commit_trends.jpg # 替換成你的 draw.py 輸出圖檔的目錄 | |
| # 如果你的 draw.py 會直接在 my-downloaded-repo 目錄下生成圖檔,可以直接寫: | |
| # path: my-downloaded-repo/*.png # 或者 my-downloaded-repo/*.jpg 等 |