Skip to content

Commit b3044c0

Browse files
committed
update README.md
1 parent e629ae7 commit b3044c0

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,11 @@ steps:
2828
2929
Before using this action, ensure the following requirements are met:
3030
31-
1. **Source Repository Checkout**: You must checkout the source repository to ensure the files you want to push are available in the workflow:
32-
```yaml
33-
- uses: actions/checkout@v4
34-
```
31+
1. **Source Repository Checkout**: You must checkout the source repository to ensure the files you want to push are available in the workflow.
3532
3633
2. **Destination Branch**: The destination branch must already exist in the destination repository. If the branch doesn't exist, the action will fail.
3734
38-
To create a new branch before using this action, use [`Songmu/action-create-branch`](https://github.com/Songmu/action-create-branch):
39-
```yaml
40-
- name: Create branch if needed
41-
uses: Songmu/action-create-branch@v0
42-
with:
43-
repository: 'owner/dest-repo'
44-
branch: 'new-branch'
45-
```
35+
To create a new branch before using this action, use [`Songmu/action-create-branch`](https://github.com/Songmu/action-create-branch).
4636

4737
### Permissions
4838

@@ -110,6 +100,32 @@ jobs:
110100
run: echo "Successfully pushed changes to the destination repository"
111101
```
112102

103+
### Creating a New Branch
104+
105+
```yaml
106+
name: Push to new branch
107+
on:
108+
push:
109+
branches:
110+
- main
111+
jobs:
112+
push-to-another-repository:
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v4
116+
persist-credentials: false
117+
- name: Create branch if needed
118+
uses: Songmu/action-create-branch@v0
119+
with:
120+
repository: 'owner/dest-repo'
121+
branch: 'new-feature'
122+
- name: Push to another repository
123+
uses: Songmu/action-push-to-another-repository@v2
124+
with:
125+
destination-repository: 'owner/dest-repo'
126+
destination-branch: 'new-feature'
127+
```
128+
113129
### Pull From Another Repository
114130

115131
You can also use this action to pull files from another repository and push them to your own repository. This is useful for syncing files or configurations across repositories.

0 commit comments

Comments
 (0)