DEV Community

JW
JW

Posted on

Sync latest template repo

My Workflow

I create cheatsheets app based on github, everyone can use this cheatsheets as template to create own cheatsheet app. But I want every user repo code update to date. So, I create github action to fetch latest changes from original repo, then create a pr.

Submission Category:

Must-Haves

Yaml File or Link to Code

GitHub logo ohmycheatsheet / actions-updater

fetch remote source repo and update current repo

@omcs/actions-updater

fetch remote source repo and update current repo

npm GitHub

features

In default, this action will diff source-template-repo and current-repo by filepath recursive

  • deleted: if current/a.file not exist in source, a.file will be deleted.
  • add: if current/a.file not exist, but source/a.file exist, a.file will be added.
  • update: if current/a.file and source/a.file exist, force update current/a.file

Friendly pr

  • read changelog as pr body
  • bump version like dependabot

image

usage

  1. create file updater.yml in .github/workflows
  2. add following code to updater.yml file
name: "updater"

on:
  schedule:
    - cron: "0 23 * * *"

jobs:
  # test action works running from the schedule
  cronjob:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: ohmycheatsheet/actions-updater@v1
      with:
        repo: ohmycheatsheet/cheatsheets
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

variables

name description type required
repo (input) source repo string true
ignores (input) ignore update files

name: "updater"

on:
  schedule:
    - cron: "0 23 * * *"

jobs:
  cronjob:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: ohmycheatsheet/actions-updater@v1
      with:
        repo: ohmycheatsheet/cheatsheets
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

there is a example repo

GitHub logo JiangWeixian / cheatsheets

a cheatsheets app based on github

cheatsheets

Built with ❤️ by ohmycheatsheet. Cheatsheets is a part of ohmycheatsheet project, a self-host cheatsheet management app! It sync your github issues to website with friendly UI~

features

  • 🚀 Easy and Fast develop
  • 🔍 Search cheasheet with algolia
  • 🌥️ Cool Website
    • Support code-share with url or image
  • 🤖 Useful Assistants Tools
    • 📩 Slack bot - Support send your recently/some-day-your-created cheatsheets with slack-bot

snapshots

homepage ▲ cheatsheets-homepage

usage

vercel

  1. Use this repo as template

  2. New dataset from algolia

  3. Set below github repo secrets

  4. Deploy to Vercel'now, in Vercel deployments settings, set below env variables as Production & Preview & Development Environment Variables

    Deploy with Vercel

  5. new issue on github'issue

netlify

  1. Use this repo as template

  2. New dataset from algolia

  3. Set below github…





screenshot

Top comments (0)