Skip to content

Improved sync script #3

@dobbelina

Description

@dobbelina

Hi again @DominiqueMakowski

I have put some effort into improving the original dmnemec /
copy_file_to_another_repo_action script by creating a while loop
that iterates the input files/folders.
That way you can use 2 folders as source.
Other fixes are changing actions/checkout@v2 to actions/checkout@v3
as v2 is deprecated.

Also added delete_existing: true [optional] that deletes all the existing files in the destination folder before copying over the new files, that way
the destination will always be identical to the source.
You can check out my repo here, Here's an example script:

on:
  push:
    branches:
      - master

name: ⏫ Copy content to REBEL

jobs:
  copy-file:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      # Copy the 'post' & 'publication' folders
      - name: Push posts & publications
        uses: dobbelina/copy_file_to_another_repo_action@main
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
        with:
          source_file: "content/post/,content/publication/" # Folders to copy
          destination_repo: "RealityBending/RealityBending.github.io" # Target repo
          destination_folder: "content/" # Folder where to copy it
          user_email: "dom.makowski@gmail.com"
          user_name: "DominiqueMakowski"
          commit_message: "AUTO: Copying posts from Dom's to REBEL's website" # Change it to ${{ github.event.head_commit.message }} to preserve the original commit message
          git_server: "github.com"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions