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")