-
-
Save thecode/2f725a121fb71840d8a245381fab9a4f to your computer and use it in GitHub Desktop.
Revisions
-
bdraco revised this gist
May 6, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d domain -p 12345 while getopts d:p: flag do -
bdraco revised this gist
May 6, 2023 . No changes.There are no files selected for viewing
-
bdraco revised this gist
May 6, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ cd "${tmp_git_dir}" info "Checking out PR#${pull_request}" git fetch origin --depth 1 "pull/${pull_request}/head" git checkout `git ls-remote origin pull/${pull_request}/head | awk '{print $1}'` if [[ ! -d "${tmp_git_dir}/homeassistant/components/${domain}" ]]; then error "Integration with ${domain} does not exist in PR#${pull_request}" -
bdraco revised this gist
May 6, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ cd "${tmp_git_dir}" info "Checking out PR#${pull_request}" git fetch origin --depth 1 "pull/${pull_request}/head" git checkout -b origin/`git ls-remote origin pull/${pull_request}/head | awk '{print $1}'` if [[ ! -d "${tmp_git_dir}/homeassistant/components/${domain}" ]]; then error "Integration with ${domain} does not exist in PR#${pull_request}" -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -67,7 +67,7 @@ info "Removing current folder ${current_dir}/custom_components/${domain}" rm -rf "${current_dir}/custom_components/${domain}" info "Copying integration files" mkdir -p "${current_dir}/custom_components" mv "${tmp_git_dir}/homeassistant/components/${domain}" "${current_dir}/custom_components/" if [[ -f "${current_dir}/custom_components/${domain}/strings.json" ]]; then -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -63,10 +63,8 @@ if [[ ! -d "${tmp_git_dir}/homeassistant/components/${domain}" ]]; then error "Integration with ${domain} does not exist in PR#${pull_request}" fi info "Removing current folder ${current_dir}/custom_components/${domain}" rm -rf "${current_dir}/custom_components/${domain}" info "Copying integration files" mkdir -p "${current_dir}/custom_components/${domain}" -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -51,10 +51,14 @@ if [[ ! -f ".HA_VERSION" ]]; then fi info "Cloning core to " git clone --depth 1 https://github.com/home-assistant/core.git "${tmp_git_dir}" cd "${tmp_git_dir}" info "Checking out PR#${pull_request}" git fetch origin --depth 1 "pull/${pull_request}/head" git checkout -b "pull/${pull_request}/head" if [[ ! -d "${tmp_git_dir}/homeassistant/components/${domain}" ]]; then error "Integration with ${domain} does not exist in PR#${pull_request}" fi -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # curl -o- -L https://gist.githubusercontent.com/ludeeus/d5d7a96823ca8cd03833c3129114b0f4/raw/core_integration_pr | bash /dev/stdin -d domain -p 12345 while getopts d:p: flag do -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # curl -o- -L https://gist.githubusercontent.com/ludeeus/d5d7a96823ca8cd03833c3129114b0f4/core_integration_pr | bash /dev/stdin -d domain -p 12345 while getopts d:p: flag do -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # wget -O - https://gist.githubusercontent.com/ludeeus/d5d7a96823ca8cd03833c3129114b0f4/raw/core_integration_pr | bash - -d domain_name -p pr_number while getopts d:p: flag do -
ludeeus renamed this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # wget -O - https://gist.githubusercontent.com/ludeeus/d5d7a96823ca8cd03833c3129114b0f4/raw/give_me_pr | bash - -d domain_name -p pr_number while getopts d:p: flag do -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 3 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -47,19 +47,14 @@ if [[ -z "${pull_request}" ]]; then fi if [[ ! -f ".HA_VERSION" ]]; then error "Not a Home Assistant folder!" fi info "Checking out home-assistant/core#${pull_request}" git clone --depth 1 --branch "pull/${pull_request}/head" https://github.com/home-assistant/core.git "${tmp_git_dir}" cd "${tmp_git_dir}" if [[ ! -d "${tmp_git_dir}/homeassistant/components/${domain}" ]]; then error "Integration with ${domain} does not exist in PR#${pull_request}" fi -
ludeeus revised this gist
Apr 18, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -78,7 +78,7 @@ if [[ -f "${current_dir}/custom_components/${domain}/strings.json" ]]; then mv "${current_dir}/custom_components/${domain}/strings.json" "${current_dir}/custom_components/${domain}/translations/en.json" fi jq --arg pull_request "${pull_request}" '.version = $pull_request' "${current_dir}/custom_components/${domain}/manifest.json" > tmp && mv -f tmp "${current_dir}/custom_components/${domain}/manifest.json" info "DONE!" info "You now need to restart Home Assistant" -
ludeeus created this gist
Apr 18, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,86 @@ #!/bin/bash # wget -O - https://some_url | bash - -d domain_name -p pr_number while getopts d:p: flag do case "${flag}" in d) domain="${OPTARG}";; p) pull_request="${OPTARG}";; esac done function info () { echo -e "${GREEN_COLOR}INFO: $1${NO_COLOR}";} function error () { echo -e "${RED_COLOR}ERROR: $1${NO_COLOR}"; if [ "$2" != "false" ]; then exit 1;fi; } current_dir="${PWD}" tmp_git_dir=/tmp/core_git set -e clean_up () { ARG=$? info "Cleaning up" cd "$current_dir" rm -rf "${tmp_git_dir}" exit $ARG } trap clean_up EXIT if [ -z "$(command -v "git")" ]; then error "'git' is not installed" fi if [ -z "$(command -v "jq")" ]; then error "'jq' is not installed" fi info "Current dir is ${current_dir}" if [[ -z "${domain}" ]]; then error "Missing domain (-d) argument"; fi if [[ -z "${pull_request}" ]]; then error "Missing pull request (-p) argument"; fi if [[ ! -f ".HA_VERSION" ]]; then info "Not a Home Assistant folder!" # exit 1 fi info "Cloning core to " git clone --depth 1 https://github.com/home-assistant/core.git "${tmp_git_dir}" cd "${tmp_git_dir}" info "Checking out PR#${pull_request}" git fetch origin "pull/${pull_request}/head" git checkout -b "pull/${pull_request}/head" if [[ ! -d "${tmp_git_dir}/homeassistant/components/${domain}" ]]; then error "Integration with ${domain} does not exist in PR#${pull_request}" fi if [[ -d "${current_dir}/custom_components/${domain}" ]]; then info "Removing current folder ${current_dir}/custom_components/${domain}" rm -rf "${current_dir}/custom_components/${domain}" fi info "Copying integration files" mkdir -p "${current_dir}/custom_components/${domain}" mv "${tmp_git_dir}/homeassistant/components/${domain}" "${current_dir}/custom_components/" if [[ -f "${current_dir}/custom_components/${domain}/strings.json" ]]; then mkdir -p "${current_dir}/custom_components/${domain}/translations" mv "${current_dir}/custom_components/${domain}/strings.json" "${current_dir}/custom_components/${domain}/translations/en.json" fi jq '.version = "${pull_request}"' "${current_dir}/custom_components/${domain}/manifest.json" > tmp && mv -f tmp "${current_dir}/custom_components/${domain}/manifest.json" info "DONE!" info "You now need to restart Home Assistant" info "NOTE: If the PR changed anything outside of it´s own folder this method will not work." info "If you want to remove this, you need to delete the ${current_dir}/custom_components/${domain} folder"