Skip to content

Allow credentials to be retrieved from the environment #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ After you've made changes to your local WordPress develop repository, you can up
grunt upload_patch:2907
```

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!

```bash
export WPORG_USERNAME=matt
export WPORG_PASSWORD=MyPasswordIsVerySecure12345
grunt uploadPatch:40000
```

## Using the file_mappings option
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.

Expand Down
18 changes: 11 additions & 7 deletions tasks/patch_wordpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,17 @@ module.exports = function( grunt ) {
);
} );
};
inquirer.prompt(
[
{ type: 'input', name: 'username', message: 'Enter your WordPress.org username' },
{ type: 'password', name: 'password', message: 'Enter your WordPress.org password' },
] ).then( ( answers ) => {
uploadPatchWithCredentials( answers.username, answers.password );
if ( process.env.WPORG_USERNAME && process.env.WPORG_PASSWORD ) {
uploadPatchWithCredentials( process.env.WPORG_USERNAME, process.env.WPORG_PASSWORD );
} else {
inquirer.prompt(
[
{ type: 'input', name: 'username', message: 'Enter your WordPress.org username' },
{ type: 'password', name: 'password', message: 'Enter your WordPress.org password' },
] ).then( ( answers ) => {
uploadPatchWithCredentials( answers.username, answers.password );
}
);
}
);
} );
};