Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] As a developer, I want to see these actions listed on the Github Marketplace. #131

Open
damienwebdev opened this issue Sep 14, 2023 · 0 comments

Comments

@damienwebdev
Copy link
Member

damienwebdev commented Sep 14, 2023

💡 Feature request

Feature Name

Github-Actions Monorepo splitter.

The Desired Behavior

It would be great if we could list these actions on the marketplace for better visibility.

@Tjitse-E was the original one to point this out, but the common pattern for actions is to put them in their own repo.

Luckily enough, since this is a git repo, doing sub-repo splits and tagging is actually quite easy.

I have an action that already does this:

name: "Publish Subtree"
author: "Graycore"
description: "A Github Action that publishes a subdirectory of a monorepo to another repo"

inputs:
  targetRepo:
    description: repository to sync the files to
    required: true
  sourceDir:
    description: sub-directory that will be the source of the repository
    required: true
  token:
    description: Github Token
    required: true
  syncBranch:
    default: sync-branch
    description: temporary branch that will be used for syncing
    required: false

runs:
  using: composite
  steps:
    # Add the target repository as a remote and fetch its branches
    - name: Add target repo and fetch branches
      run: |
        git remote add target https://oauth2:${{ inputs.token }}@${{ inputs.targetRepo }}
        git fetch target
      shell: bash
    # Sync the subdirectory using git subtree
    - name: Create subtree branch
      run: |
        git subtree split --prefix=${{ inputs.sourceDir }} -b ${{ inputs.syncBranch }}
      shell: bash
    # Push the changes to the target repository
    - name: Push changes to target repo
      run: |
        git push target ${{ inputs.syncBranch }}:main
      shell: bash
    # Create tag and push to target repo if triggered by tag event
    - name: Create tag
      if: github.ref_type == 'tag'
      shell: bash
      run: |
        git checkout ${{ inputs.syncBranch }}
        git config --global user.email "[email protected]"
        git config --global user.name "Beep Boop"
        git tag -a subtreetag -m ${{ github.ref_name }}
        git push target subtreetag:${{ github.ref_name }}

But I haven't published it anywhere public. Feel free to use it, I'm stating it as MIT-licensed.

Your Use Case

As a developer, I want to see these actions listed on the Github Marketplace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant