Skip to content

Commit

Permalink
Fix bug when scrach org username is > 80 chars (#894)
Browse files Browse the repository at this point in the history
Fixes #887
  • Loading branch information
nvuillam authored Nov 22, 2024
1 parent b7b27ba commit 57f7cf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`

## [5.7.0] 2024-11-22

- New command **hardis:git:pull-requests:extract**: Extract Pull Requests from Git Server into CSV/XLS (Azure only for now)
- Fix bug when scratch org username is > 80 chars
- Make markdown-links-check not blocking by default in MegaLinter base config
- Make yamllint not blocking by default in MegaLinter base config

Expand Down
4 changes: 3 additions & 1 deletion src/commands/hardis/scratch/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ export default class ScratchCreate extends SfCommand<any> {
this.projectScratchDef = JSON.parse(fs.readFileSync('./config/project-scratch-def.json', 'utf-8'));
this.projectScratchDef.orgName = this.scratchOrgAlias;
this.projectScratchDef.adminEmail = this.userEmail;
this.projectScratchDef.username = `${this.userEmail.split('@')[0]}@hardis-scratch-${this.scratchOrgAlias}.com`;
// Keep only first 15 and last 15 chars if scratch org alias is too long
const aliasForUsername = this.scratchOrgAlias.length > 30 ? this.scratchOrgAlias.slice(0, 15) + this.scratchOrgAlias.slice(-15) : this.scratchOrgAlias;
this.projectScratchDef.username = `${this.userEmail.split('@')[0].slice(0, 20)}@hardis-scratch-${aliasForUsername}.com`;
const projectScratchDefLocal = `./config/user/project-scratch-def-${this.scratchOrgAlias}.json`;
await fs.ensureDir(path.dirname(projectScratchDefLocal));
await fs.writeFile(projectScratchDefLocal, JSON.stringify(this.projectScratchDef, null, 2));
Expand Down

0 comments on commit 57f7cf8

Please sign in to comment.