Giter VIP home page Giter VIP logo

sync-zenn-with-dev-action's Introduction

Just sync Zenn articles to DEV ๐Ÿง˜

It can be used to sync articles written in Zenn to DEV.

โ–ถ๏ธ Usage

The minimum usage is as follows.

name: 'Sync all Zenn articles to DEV'
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: checkout my project
        uses: actions/checkout@v4
      - name: dev.to action step
        uses: nikaera/[email protected]
        id: dev-to
        with:
          # DEV API key will be required.
          api_key: ${{ secrets.api_key }}
          # (optional) Your account name in Zenn (Fields to be filled in if canonical url is set.)
          # username: nikaera
          # (optional) Synchronize only the articles in the file path divided by line breaks.
          # added_modified_filepath: ./added_modified.txt
          # (optional) Whether to sync all articles. `update_all` takes precedence over `added_modified_filepath`.
          # update_all: false
          # (optional) Specify the DEV article title format. {title} is required. {type} and {emoji} are not required.
          # title_format: "[{type}] {title} {emoji}"
        # If there is a new article to be synced to DEV,
        # the ID of the DEV article will be assigned to the markdown header of the Zenn article.
        # (This is used to determine whether the article will be newly created or updated next time.)
      - name: write article id of DEV to articles of Zenn.
        run: |
          git config user.name github-actions
          git config user.email [email protected]
          git add ${{ steps.dev-to.outputs.newly-sync-articles }}
          git commit -m "sync: Zenn with DEV [skip ci]"
          git push
        if: steps.dev-to.outputs.newly-sync-articles
        # Output the title and URL of the article synced to DEV.
      - name: Get the output articles.
        run: echo "${{ steps.dev-to.outputs.articles }}"

๐ŸŽฌ Scenario

Initially, I recommend running the following GitHub Action to sync all your articles to DEV. https://github.com/nikaera/zenn.dev/blob/main/.github/workflows/sync-zenn-with-dev-action-all.yml

After that, you can use the following GitHub Action to synchronize the article as soon as there are changes in the article file. https://github.com/nikaera/zenn.dev/blob/main/.github/workflows/sync-zenn-with-dev.yml

๐Ÿ› ๏ธ Customizing

Inputs

key description required
api_key The API Key required to use the DEV API true
username Your account name in Zenn (Fields to be filled in if canonical url is set.) false
added_modified_filepath Synchronize only the articles in the file path divided by line breaks. You can use jitterbit/get-changed-files@v1 to get only the file paths of articles that have changed in the correct format. false
update_all Whether to sync all articles. update_all takes precedence over added_modified_filepath. true
title_format Specify the DEV article title format. {title} is required. {type} and {emoji} are not required. (ex. "[{type}] {title} {emoji}") false

Outputs

key description
articles A list of URLs of dev.to articles that have been created or updated
newly-sync-articles File path list of newly synchronized articles. Make sure to commit the list of articles set to this value, as they will be updated. See action.yml

๐Ÿ“ Notes

License

MIT

sync-zenn-with-dev-action's People

Contributors

dependabot[bot] avatar nikaera avatar shun-fukumoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.