Skip to content

Generating readme file #32

Generating readme file

Generating readme file #32

name: Generate readme file on push
run-name: Generating readme file
on:
push:
branches:
- 'main'
jobs:
Generate-readme-file:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- name: check out repository code
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
ref: main
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
- name: Remove previous readme file
run: rm ${{ github.workspace }}/README.md
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install python packages
run: |
python -m pip install --upgrade pip
- name: execute py script
run: python other/scripts/readme_generator.py
- name: check for changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "FILES_CHANGED=true" >> $GITHUB_ENV
else
echo "FILES_CHANGED=false" >> $GITHUB_ENV
fi
- name: Get current date
id: date
run: echo "BUILD_TIME=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
- name: commit and push files
if: env.FILES_CHANGED == 'true'
run: |
git config --local user.email "federate-office@avl.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Automatic creation of readme file after commit on main branch on $BUILD_TIME"
git push
- run: echo "Job finished with status ${{ job.status }}."