-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vicente Canales
committed
Apr 12, 2024
1 parent
31c2de5
commit 7d56a56
Showing
3 changed files
with
79 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,34 @@ | ||
#!/bin/bash | ||
|
||
pr_number=$1 | ||
zip_paths=$2 | ||
# Parse args | ||
theme_slug=$1 | ||
branch=$2 | ||
|
||
# Placeholder for generating preview links logic | ||
# Assuming each zip_path has been processed to generate a corresponding preview link | ||
# Generate the blueprint | ||
blueprint=$(cat <<EOF | ||
{ | ||
"steps": [ | ||
{ "step": "login", "username": "admin", "password": "password" }, | ||
{ | ||
"step": "installTheme", | ||
"themeZipFile": { | ||
"resource": "url", | ||
"url": "https://github-proxy.com/partial/Automattic/themes/$theme_slug?branch=$branch" | ||
} | ||
}, | ||
{ | ||
"step": "activateTheme", | ||
"themeSlug": "$theme_slug" | ||
} | ||
] | ||
} | ||
EOF | ||
) | ||
|
||
# Minify the blueprint | ||
minified_blueprint=$(echo "$blueprint" | jq -c -M '.') | ||
|
||
# Return the preview link. | ||
echo "- [Preview changes for $theme_slug](https://playground.wordpress.net/#$minified_blueprint)" | ||
|
||
# Using jq to format the JSON body for the comment | ||
preview_links_json=$(jq -n --arg links "$preview_links" '{body: $links}') | ||
|
||
# Posting the comment using GitHub API | ||
curl -s -H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-d "$preview_links_json" \ | ||
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${pr_number}/comments" |
This file was deleted.
Oops, something went wrong.