Skip to content

Commit 0e77288

Browse files
committed
Allow credentials to be retrieved from the environment.
1 parent 587e48e commit 0e77288

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ After you've made changes to your local WordPress develop repository, you can up
5151
grunt upload_patch:2907
5252
```
5353

54+
You can also store your WordPress.org credentials in environment variables. Please exercise caution when using this option, as it may cause your credentials to be leaked!
55+
56+
```bash
57+
export WPORG_USERNAME=matt
58+
export WPORG_PASSWORD=MyPasswordIsVerySecure12345
59+
grunt uploadPatch:40000
60+
```
61+
5462
## Using the file_mappings option
5563
If you'd like to map old file paths in your patch to new file paths during the patching process, you can pass a file mappings object as an option. Using this option can be helpful when the file paths in the project have been changed since you've created your patch.
5664

tasks/patch_wordpress.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,17 @@ module.exports = function( grunt ) {
326326
);
327327
} );
328328
};
329-
inquirer.prompt(
330-
[
331-
{ type: 'input', name: 'username', message: 'Enter your WordPress.org username' },
332-
{ type: 'password', name: 'password', message: 'Enter your WordPress.org password' },
333-
] ).then( ( answers ) => {
334-
uploadPatchWithCredentials( answers.username, answers.password );
329+
if ( process.env.WPORG_USERNAME && process.env.WPORG_PASSWORD ) {
330+
uploadPatchWithCredentials( process.env.WPORG_USERNAME, process.env.WPORG_PASSWORD );
331+
} else {
332+
inquirer.prompt(
333+
[
334+
{ type: 'input', name: 'username', message: 'Enter your WordPress.org username' },
335+
{ type: 'password', name: 'password', message: 'Enter your WordPress.org password' },
336+
] ).then( ( answers ) => {
337+
uploadPatchWithCredentials( answers.username, answers.password );
338+
}
339+
);
335340
}
336-
);
337341
} );
338342
};

0 commit comments

Comments
 (0)