GithubHelp home page GithubHelp logo

mateothegreat / dependadoc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caljess599/dependadoc

0.0 1.0 0.0 11 KB

Github action that opens a PR against another repo when specified files in current repo are modified

License: MIT License

Shell 100.00%

dependadoc's Introduction

dependadoc v0.1

Github action that opens a PR against another repo when specified files in current repo are modified.

What's new

  • This is the MVP of this action.

What does dependadoc do?

In many cases, documentation is best kept close to the code it documents; in a given repo, often documentation is kept in its own folder.

Another common use case is to keep a dedicated documentation repo. This has the advantage of source control and consolidation. Also, there exist many tools (mkdocs is the one that first caught my attention) that can add beauty and searchability to repo-based documentation by rendering it into html.

Dependadoc is an action that allows for what I call the "mirroring" of documentation that is kept elsewhere than the dedicated repo to be automatically copied to the dedicated repo when it is added or updated.

A concrete example will help explain how this works.

Sample workflow

Let's say we have a repo called tooling, and within it, we keep all the docs in a folder called documentation. When a PR is merged to main in tooling, if any documentation has been added or updated, we want to mirror that documentation to our other repo, called alldocs.

Alldocs is a repo set up to be rendered by mkdocs, so all the files that are rendered are in a folder called site.

Here's the workflow file that we'll add to that repo.

# tooling/.github/workflows/main.yml

# we want to trigger our dependadoc job on *closed* PRs
# and only closed repos that were merged (we add this logic below)
on:
  pull_request:
    types: [ closed ]

jobs:
  dependadoc_job:
    # we add this conditional to avoid triggering this job
    # on PRs that are just closed without being merged
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    name: Mirror 'doc' folder to 'onedocs'
    steps:
      - uses: caljess599/[email protected]
        with:
          mirrored-folder: documentation
          docs-repository: ourorg/alldocs
          docs-repository-path: site
          docs-repository-token-variable: ${{ secrets.SOMEONES_PAT }}

Usage details

- uses: caljess599/[email protected]
  with:
    # The name of the folder in the current (where the workflow is triggered) repo.
    # required; no default
    # e.g., 
    mirrored-folder: documentation
    
    # full name (org and repo) of the where the PR of the `mirrored-folder` will be opened 
    # required; no default
    # e.g., 
    docs-repository: ourorg/alldocs
    
    # path within the someorg/alldocs repo to place mirror-current-repo folder
    # not required; default: '.'
    # e.g.,
    docs-repository-path: site
    
    # token that has proper scope to read and write to someorg/alldocs
    # because the limited scope of the default $GITHUB_TOKEN, 
    # even if you are mirroring documentation between repos
    # IN THE SAME ORGANIZATION, you will need this token for this action to work
    # required; no default
    docs-repository-token-variable: ${{ secrets.SOMEONES_PAT }}

dependadoc's People

Contributors

caljess599 avatar

Watchers

 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.