From a2f2402025c6049238476bd2fb4a7125cba21d5e Mon Sep 17 00:00:00 2001 From: Kai Liao <140431279+kliao-csa@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:38:35 -0600 Subject: [PATCH] Workflow fail summary - artifact creation (#28737) * Update recent_fail_summary.yaml * Update recent_fail_summary.yaml * Update recent_fail_summary.yaml * Update recent_fail_summary.yaml * Update summarize_fail.py * Update summarize_fail.py * Update summarize_fail.py * Update summarize_fail.py * Update summarize_fail.py * Update recent_fail_summary.yaml * Update summarize_fail.py * Update summarize_fail.py * Update summarize_fail.py --- .github/workflows/recent_fail_summary.yaml | 10 +++++++++- scripts/tools/summarize_fail.py | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/recent_fail_summary.yaml b/.github/workflows/recent_fail_summary.yaml index f41ecdc659be84..245523d6aab4b2 100644 --- a/.github/workflows/recent_fail_summary.yaml +++ b/.github/workflows/recent_fail_summary.yaml @@ -30,10 +30,18 @@ jobs: uses: actions/checkout@v3 - name: Setup run: | - gh run list -b master -s failure --json displayTitle,workflowName > runlist.json + gh run list -R project-chip/connectedhomeip -b master -s failure --json displayTitle,workflowName > run_list.json pip install pandas env: GH_TOKEN: ${{ github.token }} - name: Run Summarization Script run: python scripts/tools/summarize_fail.py + - name: Upload Logs + uses: actions/upload-artifact@v3 + with: + name: workflow-fail-summary + path: | + recent_fails.csv + recent_fails_frequency.csv + retention-days: 5 diff --git a/scripts/tools/summarize_fail.py b/scripts/tools/summarize_fail.py index 90d60ba5860379..1d491ea50d070a 100644 --- a/scripts/tools/summarize_fail.py +++ b/scripts/tools/summarize_fail.py @@ -1,7 +1,12 @@ import pandas as pd -df = pd.read_json("runlist.json") +df = pd.read_json("run_list.json") +df.columns = ["Pull Request", "Workflow"] print("Recent Failures:") -print(df) +print(df.to_string(index=False)) +df.to_csv("recent_fails.csv", index=False) +print() print("Percentage Frequency:") -print(df["workflowName"].value_counts(normalize=True) * 100) +frequency = df["Workflow"].value_counts(normalize=True).mul(100).astype(str) + "%" +print(frequency.to_string()) +frequency.to_csv("recent_fails_frequency.csv")