Skip to content

Commit

Permalink
GitHub: Don't delete all the files when exporting a theme (#1308)
Browse files Browse the repository at this point in the history
Fixes themes and plugins export that got affected by #1174:

* Uses the theme/plugin directory as the content root
* Uses the adjusted `fromPlaygroundRoot` value instead of the one coming
from the form.

Closes #1296

 ## Testing instructions

* Import https://github.com/Automattic/themes/tree/trunk/foam from
GitHub and export it immediately. There should be no files changed in
the PR.
* Confirm https://github.com/adamziel/playground-docs-workflow still
works with this PR
  • Loading branch information
adamziel authored Apr 23, 2024
1 parent f249af0 commit 5ba6f48
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,13 @@ export default function GitHubExportForm({
relativeExportPaths = ['/wp-content'];
prTitle = 'Update wp-content';
} else if (formValues.contentType === 'theme') {
fromPlaygroundRoot = docroot;
relativeExportPaths = [
`${docroot}/wp-content/themes/${formValues.theme}`,
];
fromPlaygroundRoot = `${docroot}/wp-content/themes/${formValues.theme}`;
relativeExportPaths = [`./`];
prTitle = `Update theme ${formValues.theme}`;
} else if (formValues.contentType === 'plugin') {
fromPlaygroundRoot = docroot;
fromPlaygroundRoot = `${docroot}/wp-content/plugins/${formValues.plugin}`;
relativeExportPaths = [
`${docroot}/wp-content/plugins/${formValues.plugin}`,
`./`,
];
prTitle = `Update plugin ${formValues.plugin}`;
} else if (formValues.contentType === 'custom-paths') {
Expand Down Expand Up @@ -380,9 +378,7 @@ export default function GitHubExportForm({
allPlaygroundFiles.push({
path: joinPaths(
toPathInRepo,
file.path.substring(
formValues.fromPlaygroundRoot.length
)
file.path.substring(fromPlaygroundRoot.length)
),
read: file.read,
});
Expand Down

0 comments on commit 5ba6f48

Please sign in to comment.