update readme #13
This file contains 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: Update README on Push or Pull Request | |
on: | |
push: | |
branches: | |
- master | |
- t | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12' | |
- name: Check for Allowed File Changes | |
uses: tj-actions/verify-changed-files@v19 | |
id: verify-changes | |
with: | |
# Only check for changes in Python and C++ files | |
files: | | |
**/*.py | |
**/*.cpp | |
# Fail if no allowed files changed | |
fail_on_empty_changes: true | |
- name: Check File Names | |
run: | | |
changed_files=${{ steps.verify-changes.outputs.changed_files }} | |
for file in $changed_files; do | |
if [[ ! ($file =~ ^\d[A-Z]\.(cpp|py)$) ]]; then | |
echo "Error: File '$file' does not match allowed pattern" | |
exit 1 | |
fi | |
done | |
- name: Run Python script to update README | |
run: python update_readme.py ${{ steps.verify-changes.outputs.changed_files }} | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add README.md | |
git commit -m "Update README" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.CODEFORCES_GITHUB_TOKEN }} |