mirror of
https://github.com/ad-m/github-push-action.git
synced 2025-06-09 17:45:07 +09:00
docs: Add protected branch support to the documentation
This commit is contained in:
parent
df39337088
commit
3e14145739
1 changed files with 27 additions and 2 deletions
29
README.md
29
README.md
|
@ -100,8 +100,8 @@ jobs:
|
|||
token: ${{ secrets.PAT_TOKEN }}
|
||||
- name: Commit files
|
||||
run: |
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git config --local user.email "test@test.com"
|
||||
git config --local user.name "Test"
|
||||
git commit -a -m "Add changes"
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
|
@ -162,6 +162,31 @@ jobs:
|
|||
branch: ${{ github.ref }}
|
||||
```
|
||||
|
||||
An example workflow to push to a protected branch inside your own repository. Be aware that it's necessary to use a personal access token, and maybe it is a good idea to specify the force-with-lease flag in case of sync and push errors:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
- name: Commit files
|
||||
run: |
|
||||
git config --local user.email "test@test.com"
|
||||
git config --local user.name "Test"
|
||||
git commit -a -m "Add changes"
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.PAT_TOKEN }}
|
||||
repository: Test/test
|
||||
force_with_lease: true
|
||||
```
|
||||
|
||||
### Inputs
|
||||
|
||||
| name | value | default | description |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue