Skip to content

Commit 344dfa8

Browse files
committed
Allow credentials to be retrieved from the environment.
1 parent 546b1f5 commit 344dfa8

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-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:2907 --useEnv
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: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,19 @@ module.exports = function( grunt ) {
341341
);
342342
});
343343
};
344-
inquirer.prompt(
345-
[
346-
{ type: 'input', name: 'username', message: 'Enter your WordPress.org username' },
347-
{ type: 'password', name: 'password', message: 'Enter your WordPress.org password' }
348-
]).then( answers => {
349-
uploadPatchWithCredentials( answers.username, answers.password );
344+
345+
if ( grunt.option( 'useEnv' ) ) {
346+
uploadPatchWithCredentials( process.env.WPORG_USERNAME, process.env.WPORG_PASSWORD );
347+
} else {
348+
inquirer.prompt(
349+
[
350+
{ type: 'input', name: 'username', message: 'Enter your WordPress.org username' },
351+
{ type: 'password', name: 'password', message: 'Enter your WordPress.org password' }
352+
]).then( answers => {
353+
uploadPatchWithCredentials( answers.username, answers.password );
354+
}
355+
);
350356
}
351-
);
352357
});
353358

354359
};

0 commit comments

Comments
 (0)