Skip to content

GitHub repository commit #13

GitHub repository commit

GitHub repository commit #13

# https://github.com/skills/hello-github-actions
name: GitHub repository commit
on:
workflow_dispatch:
env:
BRANCH: content-${{ github.run_id }}
permissions:
contents: write
jobs:
commit-on-branch:
name: Commit a new file
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare a branch, and file
run: |
echo -e "\n" >> README.md
date >> README.md
git checkout -b $BRANCH
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "Add date to README.md"
git push --set-upstream origin $BRANCH
git checkout main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-pull-request:
name: Create a pull request
needs: commit-on-branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Call pull request workflow
uses: ./.github/workflows/github-pull-request-creation
with:
branch: $BRANCH