Skip to content

Commit

Permalink
feat: Mirror branches to drupal.org
Browse files Browse the repository at this point in the history
Adds a GitHub action for pushing to and deleting branches on drupal.org

Issue #6
  • Loading branch information
justafish authored Nov 1, 2019
1 parent 9a52e60 commit ed362b4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/sync-repo-delete-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: drupal.org sync

on: [delete]

jobs:
delete-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Delete Remote Branch
run: |
mkdir -p ~/.ssh
eval `ssh-agent -s`
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
git remote add drupal [email protected]:project/admin_ui.git
REMOTE_BRANCH=$(echo -n ${GITHUB_REF} | sed 's/refs\/heads\///g')
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no"
GIT_SSH_COMMAND=${GIT_SSH_COMMAND} git push drupal --delete ${REMOTE_BRANCH} || true
20 changes: 20 additions & 0 deletions .github/workflows/sync-repo-push-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: drupal.org sync

on: [push]

jobs:
push-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Push to remote branch
run: |
mkdir -p ~/.ssh
eval `ssh-agent -s`
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
git remote add drupal [email protected]:project/admin_ui.git
REMOTE_BRANCH=$(echo -n ${GITHUB_REF} | sed 's/refs\/heads\///g')
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no"
GIT_SSH_COMMAND=${GIT_SSH_COMMAND} git push drupal --delete ${REMOTE_BRANCH} || true
GIT_SSH_COMMAND=${GIT_SSH_COMMAND} git checkout -b local-branch
GIT_SSH_COMMAND=${GIT_SSH_COMMAND} git push drupal local-branch:${REMOTE_BRANCH}

0 comments on commit ed362b4

Please sign in to comment.