Skip to content

Commit

Permalink
Yet another update on resources
Browse files Browse the repository at this point in the history
  • Loading branch information
drmalex07 committed Sep 6, 2024
1 parent ac5eee1 commit aa6dc6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/learn-github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ jobs:
helloworld:
runs-on: ubuntu-22.04
env:
FOO: bar
TARGET_REPO_NAME: 'hello-octapus-public'
TARGET_REPO: '${{ github.repository_owner }}/hello-octapus-public'
PATH_TO_SYNC: resources/
steps:
- run: >-
echo REPO_NAME=${GITHUB_REPOSITORY#*\/} >> $GITHUB_ENV
- run: git version
- run: pwd
- run: env | sort
Expand All @@ -36,31 +40,35 @@ jobs:
- uses: actions/checkout@v3
with:
repository: '${{ github.repository }}'
path: 'hello-octapus'
path: '${{ env.REPO_NAME }}'
submodules: true
token: ${{ secrets.REPO_READER_ACCESS_TOKEN }}
- uses: actions/checkout@v3
with:
repository: '${{ github.repository_owner }}/hello-octapus-public'
path: 'hello-octapus-public'
repository: '${{ env.TARGET_REPO }}'
path: '${{ env.TARGET_REPO_NAME }}'
submodules: true
token: ${{ secrets.REPO_WRITER_ACCESS_TOKEN }}
- run: ls -hal
- run: ls -hal
working-directory: '${{ github.workspace }}/hello-octapus'
working-directory: '${{ github.workspace }}/${{ env.REPO_NAME }}'
- run: ls -hal
working-directory: '${{ github.workspace }}/hello-octapus-public'
working-directory: '${{ github.workspace }}/${{ env.TARGET_REPO_NAME }}'
- run: rsync --version
- run: >-
rsync -avhi --delete --exclude '.gitkeep' ${{ github.workspace }}/hello-octapus/resources/ ${{ github.workspace }}/hello-octapus-public/resources/
rsync -avhi --delete --exclude '.gitkeep' ./${{ env.REPO_NAME }}/${{ env.PATH_TO_SYNC }} ./${{ env.TARGET_REPO_NAME }}/${{ env.PATH_TO_SYNC }}
- run: |-
git status
git remote -v
git config user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
working-directory: '${{ github.workspace }}/hello-octapus-public'
- run: |-
git add resources && git status
git commit -am 'Sync `resources/` folder from ${{ github.repository }}'
working-directory: '${{ github.workspace }}/${{ env.TARGET_REPO_NAME }}'
- run: >-
git status --porcelain=v1
working-directory: '${{ github.workspace }}/${{ env.TARGET_REPO_NAME }}'
- run: >-
[[ -n "$(git status --porcelain=v1)" ]] && git commit -a -m "Sync from ${GITHUB_REPOSITORY}:${PATH_TO_SYNC}"
working-directory: '${{ github.workspace }}/${{ env.TARGET_REPO_NAME }}'
- run: >-
git push origin master
working-directory: '${{ github.workspace }}/hello-octapus-public'
working-directory: '${{ github.workspace }}/${{ env.TARGET_REPO_NAME }}'
2 changes: 1 addition & 1 deletion resources/hello.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Hello (Github Actions) World
Hello (Github Actions) World!!

0 comments on commit aa6dc6e

Please sign in to comment.