Skip to content

Commit

Permalink
Provide github workflow to automatically sync and update readme to po…
Browse files Browse the repository at this point in the history
…int to drupal.org
  • Loading branch information
Randy Fay authored and Ofer Shaal committed Sep 17, 2024
1 parent 38eec09 commit 36b7f27
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 74 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This mirrors daily from an upstream repository.
# These two things must be set:
# UPSTREAM_REPO should be set to something like
# https://git.drupalcode.org/issue/drupalpod-3474581.git
# WORKFLOW_TOKEN is a secret in the "normal" environment containing
# a fine-grained PAT with permissions to read/write content and read/write workflows

name: Mirror from Upstream
defaults:
run:
shell: bash
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch: # Allows manual triggering of the workflow

permissions:
contents: write

jobs:
mirror:
runs-on: ubuntu-latest
env:
CLONEDIR: "/tmp/clonedir"
# The environment variables will be in the environment "normal"
environment: "normal"

steps:
- name: Set up Git environment
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
- name: Clone upstream repository
run: |
set -x
set -eu -o pipefail
mkdir -p ${CLONEDIR}
# The variable UPSTREAM_REPO must be set in the repository's
# "normal" environment
git clone --mirror "${{ vars.UPSTREAM_REPO }}" "${{ env.CLONEDIR }}"
- name: Remove existing Git credentials
run: |
git config --global --unset-all http.https://github.com/.extraheader || true
- name: Push to GitHub
env:
# The WORKFLOW_TOKEN is a fine-grained PAT with
# contents: read-write and
# workflow:read/write perm for this repo
WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
REPO: ${{ github.repository }}

run: |
set -x
cd ${{ env.CLONEDIR }}
git remote set-url origin "https://github.com/${REPO}.git"
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
git remote set-url origin "https://x-access-token:${WORKFLOW_TOKEN}@github.com/${REPO}.git"
git push --mirror
79 changes: 5 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,9 @@
# DrupalPod

| <h2>:point_right: Start here</h2>1. Download the DrupalPod browser extension<br>[Chrome](https://chrome.google.com/webstore/detail/drupalpod-helper-extensio/pjfjhkcfkhbemnbpkakjhmboacefmjjl?hl=en) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/drupalpod).<br><br>2. Go to any issue page on Drupal.org<br>(core, module, or theme).<br><br>3. Click on the DrupalPod extension.<br><br>4. (Optional) Choose a patch / issue fork / branch.<br><br><hr>:tada: A full Drupal development environment is being generated for you :tada:<br><br>Please submit [feedback, bug reports and feature requests](https://github.com/shaal/DrupalPod/issues/new/choose) | [![DrupalPod logo](https://user-images.githubusercontent.com/22901/122864786-40253c00-d2f3-11eb-959b-61fb6871e3f4.png)](https://gitpod.io/from-referrer/) |
| - | :- |
## **IF YOU ARE ON GITHUB THIS IS NOT THE REPOSITORY YOU WANT**
## **THE DRUPALPOD REPOSITORY HAS MOVED TO https://drupal.org/project/DrupalPod**

<br>
* Please file issues there.
* Please do Merge Requests there.
* This repo is just a mirror.

## About the project

This project allows you to work on Drupal contributions with a familiar setup of a "normal" Drupal website.\
No computer is needed because it is all running in the cloud.

* Install additional packages - `ddev composer`
* Run Drush commands - `ddev drush <command>`
* Run tests
* Nightwatch - `ddev nightwatch <arguments>`
* PHPUnit - `ddev phpunit <arguments>`
* IDE in a browser
* VScode (default)
* PHPStorm - run `phpstorm`

<br>

## Project structure

* Every project is cloned into `/repos/<project_name>`
* Required by composer
* Symlinked into a normal Drupal website structure:
* Core directory `/web/core`
* Module directory `/web/modules/contrib/module_name`
* Theme directory `/web/themes/contrib/theme_name`

<br>

## The secret sauce

* [Gitpod](https://www.gitpod.io) - development environment in the cloud
* [DDEV](https://ddev.readthedocs.io/en/stable) - easy setup for PHP projects using Docker
* [DrupalPod](https://chrome.google.com/webstore/detail/drupalpod-helper-extensio/pjfjhkcfkhbemnbpkakjhmboacefmjjl?hl=en
) Browser Extension
* [Drupal Core Development Project](https://github.com/joachim-n/drupal-core-development-project)

<br>

## Pushing code

_\* In order to push code, a **one time** SSH keys setup is required._

From within a Gitpod workspace run:

1. `.gitpod/drupal/ssh/02-setup-private-ssh.sh` \
Follow the instructions on the screen.

1. `.gitpod/drupal/ssh/04-confirm-ssh-setup.sh` \
If SSH keys are valid, it stores your private SSH key as an environment variable in Gitpod.

<br>

## Notes

* Manual SSH setup is a temporary requirement until the Drupal's self-hosted Gitlab gets integrated with Gitpod.

[WIP - making a friendlier interactive dialog](https://github.com/shaal/DrupalPod/issues/4).

* If you prefer working locally - you can clone this repo to your computer.\
The only 2 requirements are [Docker](https://ddev.readthedocs.io/en/stable/users/docker_installation/) and [DDEV](https://ddev.readthedocs.io/en/stable/#installation).

<br>

## Thank you

* [Randy Fay](https://github.com/rfay)
* [Joe Still](https://github.com/bioshazard)
* [Joachim](https://github.com/joachim-n)

---

![DrupalPod-logo](https://user-images.githubusercontent.com/22901/122864786-40253c00-d2f3-11eb-959b-61fb6871e3f4.png)

0 comments on commit 36b7f27

Please sign in to comment.