Skip to content

Commit d94e49f

Browse files
authored
Merge pull request #20 from Songmu/readme-pull
add example of pull to README
2 parents e453198 + e254d6c commit d94e49f

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,32 @@ jobs:
7272
destination-repository: 'owner/dest-repo'
7373
```
7474

75+
### Pull From Another Repository
76+
77+
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.
78+
79+
```yaml
80+
name: Pull from another repository
81+
on:
82+
schedule:
83+
- cron: '0 0 * * *'
84+
workflow_dispatch:
85+
jobs:
86+
push-to-another-repository:
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
repo: '$owner/$source-another-repo'
91+
persist-credentials: false
92+
- name: Push to another repository
93+
uses: Songmu/action-push-to-another-repository@v2
94+
with:
95+
github-token: "${{ secrets.GITHUB_TOKEN }}"
96+
destination-repository: '$you/$yourepo'
97+
source-directory: './src'
98+
destination-directory: 'vendor/another-repo'
99+
```
100+
75101
## How it Works
76102
1. The action checks out the destination repository
77103
2. Copies files from the source directory to the destination
@@ -86,7 +112,6 @@ This action requires the following permissions:
86112

87113
**Source Repository (where the workflow runs):**
88114
- `contents: read` - Read files from the source repository
89-
- `metadata: read` - Access commit history
90115

91116
**Destination Repository (where files are pushed):**
92117
- `contents: write` - Write files and create commits

0 commit comments

Comments
 (0)