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!

WARNING

2021/11/16 22:22:05 This app still under beta version~

features

  • πŸš€ Easy and Fast develop
  • πŸŒ₯️ Cool Website
    • ✨ Support code-share with url or image
  • πŸ€– Useful Assistants Tools
    • πŸ“© Slack bot - Support review your recently/some-day-your-learned cheatsheets with slack-bot
    • πŸ•ΈοΈ ctrlc - a chrome extension for pin cheatsheet from website like stackoverflow
    • 🚧 ctrlhub - a desktop management app help you manage cheatsheet like pro
    • 🚧 ctrlai - a deeplearning model help you review your cheatsheets

snapshots

homepage β–² cheatsheets-homepage

shareable-link β–² share your code with url

share-cheatsheet-image β–² share your code with image

manage-with-github-label β–² manage-with-github-label

usage

πŸ’‘ NOTE
After deploy to real world, install ohmycheatsheet github app to your cheatsheets repo first.

  1. Use this repo as template

  2. New dataset from algolia

  3. Set below github repo secrets

    • ALGOLIA_APPID=<ALGOLIA_APPID> - copy from algolia-api-keys
    • ALGOLIA_APP_KEY=<ALGOLIA_APP_KEY> - copy…




screenshot

Discussion (0)