Skip to content

Commit 1d11d89

Browse files
authored
Merge pull request #43 from Xieyt/master
Fix: block emails only when true
2 parents f831a9d + 9e88c14 commit 1d11d89

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ jobs:
5454
|---------------|---------|----------------------------------------------------------------|--------------------------------|
5555
| `user` | null | valid username. eg: `root` | Username for ssh. |
5656
| `deploy_path` | null | valid path. eg: `/opt/easyengine/sites/example.com/app/htdocs` | path where action will deploy. |
57-
| `hostname` | null | hostname. eg: `example.com` | hostname for ssh. |
57+
| `hostname` | null | hostname/ip. eg: `example.com` | hostname for ssh. |
5858

5959

6060
### Optional
6161

6262
| Variable | Default | Possible Values | Description |
6363
|---------------------------------|------------------|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
64-
| `block_emails` | null | true | If set to true, this will enable email blocking functionality. |
65-
| `block_emails_plugin_path` | null | Accept relative path from wp-content directory, eg: `custom-mu-plugins` | If you have set the `MU_PLUGIN_DIR` constant in your wp-config.php file to specify a custom path for mu-plugins, you can use this variable to install Block Emails into your custom mu-plugins directory. |
64+
| `block_emails` | null | `true`/`false` | If set to true, this will enable email blocking functionality. |
65+
| `block_emails_plugin_path` | null | Accept relative path from wp-content directory, eg: `custom-mu-plugins` | If you have set the `MU_PLUGIN_DIR` constant in your wp-config.php file to specify a custom path for mu-plugins, you can use this variable to install Block Emails into your custom mu-plugins directory. |
6666
| `block_emails_plugin_file_name` | 000-block-emails | String without the .php extension. | If you wish to modify the loading position of this plugin within the mu-plugins loading phase. |
6767
| `WP_VERSION` | null | Any valid WordPress version | If you specify a WordPress version, then that speicifc WordPress version will be downloaded, instead of latest WordPress version. **Note:** Please use double quotes while giving value to this variable. This will have higher priority then the one defined in workflow file. |
6868

@@ -71,21 +71,20 @@ jobs:
7171

7272
This GitHub action's behavior can be customized using following environment variables:
7373

74-
| Variable | Default | Possible Values | Purpose |
75-
| ------------------ | --------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
76-
| `MU_PLUGINS_URL` | null | vip, any git repo url | If value is `vip`, then action will clone [VIP's MU plugins](https://github.com/Automattic/vip-mu-plugins-public) as `mu-plugins` folder. If you want to specifiy a non-VIP mu-plugins repo, you can provide a publicly accessible mu-plugins repo URL as the value. |
77-
| `WP_VERSION` | latest | Any valid WordPress version | If you specify a WordPress version, then that speicifc WordPress version will be downloaded, instead of latest WordPress version. **Note:** Please use double quotes while giving value to this variable. Also, `WP_VERSION`, if defined in hosts.yml will have higher priority then the one defined in workflow file. |
78-
| `WP_MINOR_UPDATE` | null | `true` / `false` | If set to `true`, latest minor version of `WP_VERSION` will be taken. |
79-
| `JUMPHOST_SERVER` | null | Hostname/IP address of the jumphost server | If the deployment server is not directly accessible, and needs a jumphost, then this method should be used. (Note: The `SSH_PRIVATE_KEY` env variable should have access to the jumphost as well as deployment server for this to work. Also, this method does not work with vault.) |
80-
| `SUBMODULE_DEPLOY_KEY` | null | Read access deploy key created in the submodule repo's deploy keys. | Only required for privated submodule repo. For now only one private submodule deploy key is allowed. All public submodules in repo will be fetched by default without the need of this env variable. (To create a deploy key go to: Settings > Deploy Keys > Add deploy key) |
81-
| `SKIP_WP_TASKS` | null | `true`/`false` | If set to `true`, WordPress specific deplyment tasks will skipped. |
82-
| `PHP_VERSION` | 7.4 | Valid PHP version | Determines the cachetool version compatible to use for purging opcache. |
83-
| `NPM_VERSION` | null | Valid NPM Version | NPM Version. If not specified, latest version will be used. |
84-
| `NODE_VERSION` | null | Valid Node Version | If not specified, default version built into action will be used. |
85-
| `NODE_BUILD_DIRECTORY` | null | path to valid directory on repository. | Build directory. Generally root directory or directory like frontend. |
86-
| `NODE_BUILD_COMMAND` | null | `npm run build` or similar command. | Command used to to build the dependencies needed on deployment. |
87-
| `NODE_BUILD_SCRIPT` | null | path to valid shell script | Custom or predefined script to run after compilation. |
88-
| `BLOCK_EMAILS` | null | true | If set to true, this will enable email blocking functionality. |
74+
| Variable | Default | Possible Values | Purpose |
75+
|------------------------|---------|---------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
76+
| `MU_PLUGINS_URL` | null | vip, any git repo url | If value is `vip`, then action will clone [VIP's MU plugins](https://github.com/Automattic/vip-mu-plugins-public) as `mu-plugins` folder. If you want to specifiy a non-VIP mu-plugins repo, you can provide a publicly accessible mu-plugins repo URL as the value. |
77+
| `WP_VERSION` | latest | Any valid WordPress version | If you specify a WordPress version, then that speicifc WordPress version will be downloaded, instead of latest WordPress version. **Note:** Please use double quotes while giving value to this variable. Also, `WP_VERSION`, if defined in hosts.yml will have higher priority then the one defined in workflow file. |
78+
| `WP_MINOR_UPDATE` | null | `true` / `false` | If set to `true`, latest minor version of `WP_VERSION` will be taken. |
79+
| `JUMPHOST_SERVER` | null | Hostname/IP address of the jumphost server | If the deployment server is not directly accessible, and needs a jumphost, then this method should be used. (Note: The `SSH_PRIVATE_KEY` env variable should have access to the jumphost as well as deployment server for this to work. Also, this method does not work with vault.) |
80+
| `SUBMODULE_DEPLOY_KEY` | null | Read access deploy key created in the submodule repo's deploy keys. | Only required for privated submodule repo. For now only one private submodule deploy key is allowed. All public submodules in repo will be fetched by default without the need of this env variable. (To create a deploy key go to: Settings > Deploy Keys > Add deploy key) |
81+
| `SKIP_WP_TASKS` | null | `true`/`false` | If set to `true`, WordPress specific deplyment tasks will skipped. |
82+
| `PHP_VERSION` | 7.4 | Valid PHP version | Determines the cachetool version compatible to use for purging opcache. |
83+
| `NPM_VERSION` | null | Valid NPM Version | NPM Version. If not specified, latest version will be used. |
84+
| `NODE_VERSION` | null | Valid Node Version | If not specified, default version built into action will be used. |
85+
| `NODE_BUILD_DIRECTORY` | null | path to valid directory on repository. | Build directory. Generally root directory or directory like frontend. |
86+
| `NODE_BUILD_COMMAND` | null | `npm run build` or similar command. | Command used to to build the dependencies needed on deployment. |
87+
| `NODE_BUILD_SCRIPT` | null | path to valid shell script | Custom or predefined script to run after compilation. |
8988

9089
All node related variables are completely optional. You can use them if your site needs to have node dependencies built.
9190

main.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ function block_emails() {
271271
hosts_block_email=$(shyaml get-value "$GITHUB_BRANCH.block_emails" < "$hosts_file" 2>/dev/null || exit 0)
272272

273273
if [[ -n "$hosts_block_email" ]]; then
274-
BLOCK_EMAILS="$hosts_block_email"
274+
match_hosts_block_email=$(echo "$hosts_block_email" | awk '{$1=$1;print tolower($0)}')
275275
fi
276276

277-
if [[ -n "$BLOCK_EMAILS" ]]; then
277+
if [[ "$match_hosts_block_email" == 'true' ]]; then
278278

279279
# priority: 1. hosts.yml 2. vip 3. WP
280-
echo -e "\033[34mSETUP EMAIL BLOCKING\033[0m"
280+
echo -e "\033[34mSETTING UP EMAIL BLOCKING\033[0m"
281281

282282
hosts_block_email_dir=$(shyaml get-value "$GITHUB_BRANCH.block_emails_plugin_path" < "$hosts_file" 2>/dev/null || exit 0)
283283

0 commit comments

Comments
 (0)