Giter VIP home page Giter VIP logo

planetoftheweb / copy-to-branches Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 7.0 32 KB

Copies files from any 'key' branch to all other branches. By default, LICENSE, NOTICE and README.md will be copied from the main/master branch to all branches, but it can be configured so you can specify a list of branches, a list of files or branches to exclude from all branches.

License: MIT License

Dockerfile 5.21% Shell 94.79%
github actions utility branches-workflow workflow shell alpine bash

copy-to-branches's Introduction

Copy To Branches Action/Shell Script

This action runs a shell script entrypoint.sh file which lets you copy one or more files from a key branch to any other branches in your repo. By default, it copies the following files

  • LICENSE
  • NOTICE
  • README.md
  • CONTRIBUTING.md
  • ./vscode/settings.json
  • .devcontainer/devcontainer.json
  • .github/CODEOWNERS
  • .github/ISSUE_TEMPLATE.MD
  • .github/PULL_REQUEST_TEMPLATE.MD
  • .github/workflows/main.yml

From the main/master branch to all branches on repository.

Running this action

  1. Go to your repo
  2. Click on the Actions tab

Click on Actions Tab

  1. Click on the Set up a workflow yourself link

Set up a workflow yourself link

  1. Use the following script.
name: Copy To Branches
on:
  workflow_dispatch:
jobs:
  copy-to-branches:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Copy To Branches Action
        uses: planetoftheweb/[email protected]
        env:
          key: main
  1. Click the Start commit button

Start Commit Button

  1. Click back on the Actions tab
  2. Click on the Copy To Branches workflow
  3. Click on Run Workflow

The workflow should run automatically, you can monitor it if you want to.

Optional Arguments

By default, the action will try to copy the LICENSE, NOTICE and README.md files from the main branch to all branches, but you can modify the behavior by adding a list of arguments in an env variable.

Example

name: Copy To Branches
on:
  workflow_dispatch:
jobs:
  copy-to-branches:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Copy To Branches Action
        uses: planetoftheweb/copy-to-branches@v1
        env:
          key: main
          exclude: work 99_target
          files: README.md

Using the key branch named main This will copy only the README.md file to all branches, but skip two branches, one named work and one called 99_target.

Key

This is the key branch that you're using as the origin, in other words, the branch you want to copy from. By default, you should include main, but you can ask for a different branch to copy from. Say you wanted to copy files from the branch named 02_03b to all branches. You would use:

env:
  key: 02_03b

Files to copy

By default, the script assumes you want to copy the LICENSE, NOTICE and README.md files. If you want to change this, you can pass along a different list of files to use instead. Use the files keyword and then pass a list of one or more branches separated by spaces.

env:
  files: README.md NOTICE

Branches to Copy

By default, the script assumes you want to copy the files to all the branches in the repo. If you want to copy the files to only certain branches, then you can include this option.

env:
  branches: 02_03b 02_03e 02_04b
  key: main

โš ๏ธ When you add a custom branch list, if you don't include a main or master branch in your list, the script wont run because it won't have a key branch to copy to.

You can easily add a key branch with the key option.

Branches to Exclude

By default, the script will copy the files to all branches. You can exclude one or more branches by creating a list of branches to exclude.

env:
  exclude: target gh-pages

copy-to-branches's People

Contributors

itamarc avatar peternewman avatar planetoftheweb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.