Story

I plan to auto push blog from hashnode to hugo. So this is the first step. My repo has 2 branch:

  • main: is the branch that hashnode gonna backup the posts there in md format.
  • Hugo: is the branch that contains Hugo blog

Step 1: Make sure your Actions has permission to write to the repo.

image

Step 2: Create the github actions

ref: https://github.com/devmasx/merge-branch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
name: Merge main to Hugo

on:
  push:
    branches:
      - main

jobs:
  merge-branch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master

      - name: Merge main -> Hugo
        uses: devmasx/merge-branch@master
        with:
          type: now
          target_branch: Hugo
          github_token: ${{ secrets.GITHUB_TOKEN }}