Skip to content

Merge pull request #29 from talgat-abdraimov/feature/make #32

Merge pull request #29 from talgat-abdraimov/feature/make

Merge pull request #29 from talgat-abdraimov/feature/make #32

Workflow file for this run

name: Repo Created
on:
push:
branches:
- main
permissions:
contents: write
jobs:
# This job checks if the repository is new runs only once and deletes itself
check-initial-commit:
if: ${{ !github.event.repository.is_template }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if initial commit
id: check
run: |
if [ $(git rev-list --count HEAD) -le 1 ]
then
echo "initial_commit=true" >> $GITHUB_OUTPUT
else
echo "initial_commit=false" >> $GITHUB_OUTPUT
fi
- name: Change README
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.check.outputs.initial_commit == 'true'
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
echo "# ${{github.event.repository.name}} project :wave:" > README.md
echo "---" >> README.md
echo "## Usage" >> README.md
echo "" >> README.md
echo '1. Clone the project: ```git clone [email protected]:{your-username}/${{github.event.repository.name}}.git```' >> README.md
echo "" >> README.md
echo '2. 'Go to the project folder: ```cd ${{github.event.repository.name}}```' >> README.md
echo "" >> README.md
echo '3. Create virtual environment for project: ```make venv```' >> README.md
echo "" >> README.md
echo '4. Activate virtual environment: ```source ./venv/bin/activate```' >> README.md
echo "" >> README.md
echo '5. Install dependencies: ```make dev-deps```' >> README.md
echo "" >> README.md
echo '6. Run build command: ```make build```' >> README.md
git add README.md
git commit -m "Changed README.md"
git push
- name: Remove current workflow
if: steps.check.outputs.initial_commit == 'true'
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git rm .github/workflows/update-readme.yml
git commit -m "Remove initial commit workflow"
git push
- name: Create develop branch
if: steps.check.outputs.initial_commit == 'true'
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git checkout -b develop
git push -u origin develop