TheAlgorithms-Python/.github/workflows/directory_writer.yml

26 lines
985 B
YAML
Raw Normal View History

# The objective of this GitHub Action is to add a new DIRECTORY.md file to a pull request if needed.
name: directory_writer
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Update DIRECTORY.md
run: |
scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
git config --global user.name 'directory_writer'
git config --global user.email 'mrvnmchm@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.gh_token }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
if git diff-files --quiet; then echo 0; else git commit -am "fixup: DIRECTORY.md" && git push; fi