github action commit to remote repository
#Github #actions help you to #automate Processes (CI/CD).
In my Example I tried to checkout source code, scan for Strings, append found Strings to a File and commit changes to separate repository.
As you know, actions are saved in your Repository under the Path:
.github/workflows/workflow.yaml
steps:
# check out source repository
- name: checkout source repository (this)
uses: actions/checkout@v3
# check out target repository
- name: checkout target
uses: actions/checkout@v3
with:
repository: example/target
ssh-key: ${{ secrets.DEPLOY_SECRET }}
# do your thing...
- name: do things
run: modify files in target...
# commit to target repository
- name: commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: example/target
Explanation: -1. Checkout run with “example/source” -2․ Checkout run with “example/target” – used “with”: – repository to Checkout a other Repo – ssh-key for authentication (Deploy Key for target) -3. commit Changes, if found
Good luck!