Skip to content

Create update_muted_ya.yml #16197

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/update_muted_ya.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Update Muted YA

on:
schedule:
- cron: '0 7 * * *' # Запуск ежедневно в 7 утра UTC
workflow_dispatch:

jobs:
create-or-update-muted-ya:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ydb[yc] PyGithub

- name: Setup ydb access
uses: ./.github/actions/setup_ci_ydb_service_account_key_file_credentials
with:
ci_ydb_service_account_key_file_credentials: ${{ secrets.CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS }}

- name: Update branch with main
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout main
git pull --rebase origin main
git fetch origin create-muted-ya || true
if [ -n "$(git branch -a | grep remotes/origin/create-muted-ya)" ]; then
git checkout create-muted-ya
git rebase main
else
git checkout -b create-muted-ya
fi

- name: Run the script
run: |
.github/scripts/tests/create_new_muted_ya.py

- name: Move new_muted_ya_with_flaky.txt to muted_ya.txt
run: |
cp mute_update/new_muted_ya_with_flaky.txt .github/config/muted_ya.txt

- name: Check if changes exist
id: changes_check
run: |
if git diff --quiet .github/config/muted_ya.txt; then
echo "No changes detected in muted_ya.txt"
exit 0
else
echo "Changes detected in muted_ya.txt"
echo "changes=true" >> $GITHUB_ENV
fi

- name: Collect PR description
id: pr_description
run: |
PR_BODY="Automatically updated muted YA file by GitHub Actions.\n\n"
if [ -s mute_update/deleted_tests_in_mute_debug.txt ]; then
DELETED_COUNT=$(wc -l < mute_update/deleted_tests_in_mute_debug.txt)
PR_BODY="${PR_BODY}Remove deleted from mute: ${DELETED_COUNT}\n```\n$(cat mute_update/deleted_tests_in_mute_debug.txt)\n```\n\n"
fi
if [ -s mute_update/flaky_debug.txt ]; then
FLAKY_COUNT=$(wc -l < mute_update/flaky_debug.txt)
PR_BODY="${PR_BODY}Mute flaky: ${FLAKY_COUNT}\n```\n$(cat mute_update/flaky_debug.txt)\n```\n\n"
fi
if [ -s mute_update/muted_stable_debug.txt ]; then
MUTED_STABLE_COUNT=$(wc -l < mute_update/muted_stable_debug.txt)
PR_BODY="${PR_BODY}Unmute stable: ${MUTED_STABLE_COUNT}\n```\n$(cat mute_update/muted_stable_debug.txt)\n```\n\n"
fi
echo "PR_BODY=${PR_BODY}" >> $GITHUB_ENV

- name: Stage changes if any
if: env.changes == 'true'
run: |
git add .github/config/muted_ya.txt

- name: Commit changes
if: env.changes == 'true'
run: |
git commit -m "Update muted YA file"

- name: Push changes
if: env.changes == 'true'
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: create-muted-ya
force: true

- name: Create or update pull request
if: env.changes == 'true'
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: create-muted-ya
base: main
title: "Update Muted YA File"
body: ${{ env.PR_BODY }}
labels: "Automated PR"
reviewers: "ydb-platform/engineering"
create-when-empty: false
allow-empty-commit: false
draft: false

- name: Update pull request if exists
if: env.changes == 'true' && steps.cpr.outputs.pull_request_number != ''
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull_request_number }}
branch: create-muted-ya
base: main
title: "Update Muted YA File"
body: ${{ env.PR_BODY }}
labels: "Automated PR"
reviewers: "ydb-platform/engineering"

- name: Log message if no changes
if: env.changes != 'true'
run: echo "No changes to commit. Exiting Workflow without further actions."