Skip to content

GitHub repository commit #28

GitHub repository commit

GitHub repository commit #28

# 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
outputs:
branch-name: ${{ steps.commit-step.outputs.branch-name }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare a branch, and file
id: commit-step
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
echo "branch-name: $BRANCH"
echo "branch-name=$BRANCH" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
call-pull-request-workflow:

Check failure on line 40 in .github/workflows/github-repository-commit.yml

View workflow run for this annotation

GitHub Actions / GitHub repository commit

Invalid workflow file

The workflow is not valid. .github/workflows/github-repository-commit.yml (Line: 40, Col: 3): Error calling workflow 'tsubakimoto/github-actions-samples/.github/workflows/github-pull-request-creation.yml@e79de2ff02196b990a96d1aa35605385923eb0e3'. The workflow 'tsubakimoto/github-actions-samples/.github/workflows/github-pull-request-creation.yml@e79de2ff02196b990a96d1aa35605385923eb0e3' is requesting 'pull-requests: write', but is only allowed 'pull-requests: none'.
name: Call pull request workflow
needs: commit-on-branch
uses: ./.github/workflows/github-pull-request-creation.yml
with:
branch-name: ${{ needs.commit-on-branch.outputs.branch-name }}