Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow fail summary - artifact creation #28737

Merged
merged 14 commits into from
Aug 21, 2023
10 changes: 9 additions & 1 deletion .github/workflows/recent_fail_summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

11 changes: 8 additions & 3 deletions scripts/tools/summarize_fail.py
Original file line number Diff line number Diff line change
@@ -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")