Add default tasks and commands #3263
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Git Management | |
on: [push] | |
env: | |
GITHUB_USERNAME: devshopbot | |
GITSPLIT_GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
DEVSHOP_REPO: opendevshop/devshop | |
DEVSHOP_PACKAGES_REPO: devshop-packages/git-split | |
jobs: | |
monorepo-split: | |
name: Split Git Repositories | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Confirm write access to $DEVSHOP_REPO | |
run: | | |
curl -u $GITHUB_USERNAME:$GITSPLIT_GITHUB_TOKEN https://api.github.com/repos/$DEVSHOP_REPO/collaborators/$GITHUB_USERNAME/permission | grep "permission" | grep "admin | |
write" | |
- name: Confirm write access to $DEVSHOP_PACKAGES_REPO. | |
run: | | |
curl -u $GITHUB_USERNAME:$GITSPLIT_GITHUB_TOKEN https://api.github.com/repos/$DEVSHOP_PACKAGES_REPO/collaborators/$GITHUB_USERNAME/permission | grep "permission" | grep "admin | |
write" | |
- uses: fregante/setup-git-token@v1 | |
with: | |
token: ${{ secrets.INPUT_GITHUB_TOKEN }} | |
- name: Cache git split database file. | |
uses: actions/cache@v1 | |
with: | |
path: $RUNNER_WORKSPACE/devshop/.git/splitsh.db | |
key: 'splitsh-cache' | |
- name: Show Git Information | |
run: env | grep GITHUB | |
- name: Create a branch for the splitsh | |
run: git checkout -b $( echo ${GITHUB_REF} | sed 's/refs\/heads\///') | |
- run: mkdir $HOME/.ssh | |
- name: Authorize GitHub.com as a known_host | |
run: ssh-keyscan github.com > $HOME/.ssh/known_hosts | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress | |
# @TODO: Our plugin could be coded to output the commands needed to run splitsh-lite.sh directly. This would shorten CI runs because we wouldn't need composer install for the Git Split job. | |
- name: Split monorepo | |
run: composer git:split |