WF
This commit is contained in:
parent
a741dce958
commit
f921b0f9b4
43
.github/workflows/move-to-main-repo.yaml
vendored
43
.github/workflows/move-to-main-repo.yaml
vendored
@ -27,32 +27,43 @@ jobs:
|
|||||||
echo "script_name=$script_name_lowercase" >> $GITHUB_ENV
|
echo "script_name=$script_name_lowercase" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Check if script files exist
|
- name: Check if script files exist
|
||||||
|
id: check_files
|
||||||
run: |
|
run: |
|
||||||
script_name="${{ env.script_name }}"
|
script_name="${{ env.script_name }}"
|
||||||
|
|
||||||
|
# Check if files exist under /ct, /install, and /json
|
||||||
ct_file="/ct/$script_name.sh"
|
ct_file="/ct/$script_name.sh"
|
||||||
install_file="/install/$script_name-install.sh"
|
install_file="/install/$script_name-install.sh"
|
||||||
json_file="/json/$script_name.json"
|
json_file="/json/$script_name.json"
|
||||||
|
|
||||||
echo "Checking for script files:"
|
echo "Checking for script files:"
|
||||||
|
|
||||||
if [[ -f "$ct_file" ]]; then
|
if [[ -f "$ct_file" && -f "$install_file" && -f "$json_file" ]]; then
|
||||||
echo "Found $ct_file"
|
echo "All required files found."
|
||||||
|
echo "files_found=true" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo "File not found: $ct_file"
|
echo "Not all required files were found."
|
||||||
exit 1
|
echo "files_found=false" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$install_file" ]]; then
|
- name: Create PR if files found
|
||||||
echo "Found $install_file"
|
if: env.files_found == 'true'
|
||||||
else
|
run: |
|
||||||
echo "File not found: $install_file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "$json_file" ]]; then
|
target_repo="community-scripts/ProxmoxVE"
|
||||||
echo "Found $json_file"
|
|
||||||
else
|
branch_name="add-script-$script_name"
|
||||||
echo "File not found: $json_file"
|
|
||||||
exit 1
|
commit_message="Add script files for $script_name"
|
||||||
fi
|
|
||||||
|
git checkout -b "$branch_name"
|
||||||
|
|
||||||
|
cp "/ct/$script_name.sh" .
|
||||||
|
cp "/install/$script_name-install.sh" .
|
||||||
|
cp "/json/$script_name.json" .
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "$commit_message"
|
||||||
|
git push origin "$branch_name"
|
||||||
|
|
||||||
|
gh pr create --title "Add script files for $script_name" --body "This PR adds the $script_name script files." --base main --head "$branch_name" --repo "$target_repo"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user