update workflows VED
This commit is contained in:
parent
617d9f8fc0
commit
63b9f8a8c1
12
.github/ISSUE_TEMPLATE/new-script.yaml
vendored
12
.github/ISSUE_TEMPLATE/new-script.yaml
vendored
@ -15,6 +15,18 @@ body:
|
|||||||
placeholder: e.g., SnipeIT
|
placeholder: e.g., SnipeIT
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: script_type
|
||||||
|
attributes:
|
||||||
|
label: Script Type
|
||||||
|
description: What type of script is this?
|
||||||
|
options:
|
||||||
|
- CT (LXC Container)
|
||||||
|
- VM (Virtual Machine)
|
||||||
|
- Addon (tools/addon)
|
||||||
|
- PVE Tool (tools/pve)
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: task_details
|
id: task_details
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@ -13,23 +13,73 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: contains(github.event.issue.labels.*.name, 'Ready For Testing') && github.repository == 'community-scripts/ProxmoxVED'
|
if: contains(github.event.issue.labels.*.name, 'Ready For Testing') && github.repository == 'community-scripts/ProxmoxVED'
|
||||||
steps:
|
steps:
|
||||||
- name: Extract Issue Title (Lowercase & Underscores)
|
- name: Extract Issue Title and Script Type
|
||||||
id: extract_title
|
id: extract_info
|
||||||
run: echo "TITLE=$(echo '${{ github.event.issue.title }}' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')" >> $GITHUB_ENV
|
run: |
|
||||||
|
# Extract title (lowercase, spaces to dashes)
|
||||||
|
TITLE=$(echo '${{ github.event.issue.title }}' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')
|
||||||
|
echo "TITLE=$TITLE" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Check if Files Exist in community-scripts/ProxmoxVE
|
# Extract script type from issue body
|
||||||
|
BODY='${{ github.event.issue.body }}'
|
||||||
|
|
||||||
|
if echo "$BODY" | grep -qi "CT (LXC Container)"; then
|
||||||
|
SCRIPT_TYPE="ct"
|
||||||
|
elif echo "$BODY" | grep -qi "VM (Virtual Machine)"; then
|
||||||
|
SCRIPT_TYPE="vm"
|
||||||
|
elif echo "$BODY" | grep -qi "Addon (tools/addon)"; then
|
||||||
|
SCRIPT_TYPE="addon"
|
||||||
|
elif echo "$BODY" | grep -qi "PVE Tool (tools/pve)"; then
|
||||||
|
SCRIPT_TYPE="pve"
|
||||||
|
else
|
||||||
|
# Fallback: detect by filename pattern or default to ct
|
||||||
|
if [[ "$TITLE" == *"-vm"* ]]; then
|
||||||
|
SCRIPT_TYPE="vm"
|
||||||
|
else
|
||||||
|
SCRIPT_TYPE="ct"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "SCRIPT_TYPE=$SCRIPT_TYPE" >> $GITHUB_ENV
|
||||||
|
echo "Detected script type: $SCRIPT_TYPE"
|
||||||
|
|
||||||
|
- name: Check if Files Exist in community-scripts/ProxmoxVED
|
||||||
id: check_files
|
id: check_files
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
REPO="community-scripts/ProxmoxVED"
|
REPO="community-scripts/ProxmoxVED"
|
||||||
API_URL="https://api.github.com/repos/$REPO/contents"
|
API_URL="https://api.github.com/repos/$REPO/contents"
|
||||||
|
TITLE="${{ env.TITLE }}"
|
||||||
|
SCRIPT_TYPE="${{ env.SCRIPT_TYPE }}"
|
||||||
|
|
||||||
FILES=(
|
# Define files based on script type
|
||||||
"ct/${{ env.TITLE }}.sh"
|
case "$SCRIPT_TYPE" in
|
||||||
"install/${{ env.TITLE }}-install.sh"
|
ct)
|
||||||
"frontend/public/json/${{ env.TITLE }}.json"
|
FILES=(
|
||||||
)
|
"ct/${TITLE}.sh"
|
||||||
|
"install/${TITLE}-install.sh"
|
||||||
|
"frontend/public/json/${TITLE}.json"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
FILES=(
|
||||||
|
"vm/${TITLE}.sh"
|
||||||
|
"frontend/public/json/${TITLE}.json"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
FILES=(
|
||||||
|
"tools/addon/${TITLE}.sh"
|
||||||
|
"frontend/public/json/${TITLE}.json"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
FILES=(
|
||||||
|
"tools/pve/${TITLE}.sh"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
EXISTING_FILES=()
|
EXISTING_FILES=()
|
||||||
|
|
||||||
@ -42,43 +92,65 @@ jobs:
|
|||||||
echo "$FILE does NOT exist in $REPO"
|
echo "$FILE does NOT exist in $REPO"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "EXISTING_FILES=${EXISTING_FILES[@]}" >> $GITHUB_ENV
|
echo "EXISTING_FILES=${EXISTING_FILES[*]}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Create message to send
|
- name: Create message to send
|
||||||
id: create_message
|
id: create_message
|
||||||
run: |
|
run: |
|
||||||
VAR="The ${{ env.TITLE }} script is ready for testing:\n"
|
TITLE="${{ env.TITLE }}"
|
||||||
if [[ "${{ env.TITLE }}" != *"vm"* ]]; then
|
SCRIPT_TYPE="${{ env.SCRIPT_TYPE }}"
|
||||||
VAR+="\`\`\`bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${{ env.TITLE }}.sh)\"\`\`\`\n"
|
|
||||||
else
|
|
||||||
VAR+="\`\`\`bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/vm/${{ env.TITLE }}.sh)\"\`\`\`\n"
|
|
||||||
fi
|
|
||||||
if [[ " ${EXISTING_FILES[@]} " =~ " frontend/public/json/${TITLE}.json " ]]; then
|
|
||||||
JSON=$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/frontend/public/json/${{ env.TITLE }}.json)
|
|
||||||
username=$(echo "$JSON" | jq -r '.default_credentials.username')
|
|
||||||
password=$(echo "$JSON" | jq -r '.default_credentials.password')
|
|
||||||
mapfile -t notes_array < <(echo "$JSON" | jq -r '.notes[].text')
|
|
||||||
|
|
||||||
if [[ -n "$username" && "$username" != "null" || -n "$password" && "$password" != "null" ]]; then
|
VAR="The ${TITLE} script is ready for testing:\n"
|
||||||
VAR+="Default credentials:\n"
|
|
||||||
|
|
||||||
if [[ -n "$username" && "$username" != "null" ]]; then
|
# Generate correct command based on script type
|
||||||
VAR+="Username: $username\n"
|
case "$SCRIPT_TYPE" in
|
||||||
fi
|
ct)
|
||||||
|
VAR+="\`\`\`bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${TITLE}.sh)\"\`\`\`\n"
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
VAR+="\`\`\`bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/vm/${TITLE}.sh)\"\`\`\`\n"
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
VAR+="\`\`\`bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/tools/addon/${TITLE}.sh)\"\`\`\`\n"
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
VAR+="\`\`\`bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/tools/pve/${TITLE}.sh)\"\`\`\`\n"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [[ -n "$password" && "$password" != "null" ]]; then
|
# Try to get JSON info (may not exist for all types)
|
||||||
VAR+="Password: $password\n"
|
JSON_FILE=""
|
||||||
fi
|
case "$SCRIPT_TYPE" in
|
||||||
VAR+="\n"
|
ct|vm|addon)
|
||||||
fi
|
JSON_FILE="frontend/public/json/${TITLE}.json"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ ${#notes_array[@]} -gt 0 ]; then
|
if [[ -n "$JSON_FILE" ]]; then
|
||||||
for note in "${notes_array[@]}"; do
|
JSON=$(curl -fsSL "https://github.com/community-scripts/ProxmoxVED/raw/main/${JSON_FILE}" 2>/dev/null || echo "{}")
|
||||||
VAR+="$note\n"
|
|
||||||
done
|
if [[ "$JSON" != "{}" && "$JSON" != "" ]]; then
|
||||||
VAR+="\n"
|
username=$(echo "$JSON" | jq -r '.default_credentials.username // empty')
|
||||||
|
password=$(echo "$JSON" | jq -r '.default_credentials.password // empty')
|
||||||
|
|
||||||
|
if [[ -n "$username" || -n "$password" ]]; then
|
||||||
|
VAR+="Default credentials:\n"
|
||||||
|
[[ -n "$username" ]] && VAR+="Username: $username\n"
|
||||||
|
[[ -n "$password" ]] && VAR+="Password: $password\n"
|
||||||
|
VAR+="\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get notes
|
||||||
|
mapfile -t notes_array < <(echo "$JSON" | jq -r '.notes[]?.text // empty' 2>/dev/null)
|
||||||
|
if [ ${#notes_array[@]} -gt 0 ]; then
|
||||||
|
for note in "${notes_array[@]}"; do
|
||||||
|
[[ -n "$note" ]] && VAR+="$note\n"
|
||||||
|
done
|
||||||
|
VAR+="\n"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VAR+="Note: This is not in the official repo yet—it's just a dev version! After merging into ProxmoxVE, it will need to be recreated.\n\n"
|
VAR+="Note: This is not in the official repo yet—it's just a dev version! After merging into ProxmoxVE, it will need to be recreated.\n\n"
|
||||||
VAR+="Discussion & issue tracking:\n"
|
VAR+="Discussion & issue tracking:\n"
|
||||||
VAR+="${{ github.event.issue.html_url }}"
|
VAR+="${{ github.event.issue.html_url }}"
|
||||||
|
|||||||
128
.github/workflows/delete_new_script.yaml
vendored
128
.github/workflows/delete_new_script.yaml
vendored
@ -23,9 +23,34 @@ jobs:
|
|||||||
owner: community-scripts
|
owner: community-scripts
|
||||||
repositories: ProxmoxVED
|
repositories: ProxmoxVED
|
||||||
|
|
||||||
- name: Extract Issue Title (Lowercase & Underscores)
|
- name: Extract Issue Info and Script Type
|
||||||
id: extract_title
|
id: extract_info
|
||||||
run: echo "TITLE=$(echo '${{ github.event.issue.title }}' | tr '[:upper:]' '[:lower:]' | sed 's/ /_/g')" >> $GITHUB_ENV
|
run: |
|
||||||
|
TITLE=$(echo '${{ github.event.issue.title }}' | tr '[:upper:]' '[:lower:]' | tr -d ' ')
|
||||||
|
BODY='${{ github.event.issue.body }}'
|
||||||
|
|
||||||
|
echo "TITLE=$TITLE" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Detect script type from issue body
|
||||||
|
if echo "$BODY" | grep -qi "CT (LXC Container)"; then
|
||||||
|
SCRIPT_TYPE="ct"
|
||||||
|
elif echo "$BODY" | grep -qi "VM (Virtual Machine)"; then
|
||||||
|
SCRIPT_TYPE="vm"
|
||||||
|
elif echo "$BODY" | grep -qi "Addon (tools/addon)"; then
|
||||||
|
SCRIPT_TYPE="addon"
|
||||||
|
elif echo "$BODY" | grep -qi "PVE Tool (tools/pve)"; then
|
||||||
|
SCRIPT_TYPE="pve"
|
||||||
|
else
|
||||||
|
# Fallback detection
|
||||||
|
if [[ "$TITLE" == *"-vm"* ]]; then
|
||||||
|
SCRIPT_TYPE="vm"
|
||||||
|
else
|
||||||
|
SCRIPT_TYPE="ct"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "SCRIPT_TYPE=$SCRIPT_TYPE" >> $GITHUB_ENV
|
||||||
|
echo "Detected: $TITLE (type: $SCRIPT_TYPE)"
|
||||||
|
|
||||||
- name: Check if Files Exist in community-scripts/ProxmoxVE
|
- name: Check if Files Exist in community-scripts/ProxmoxVE
|
||||||
id: check_files
|
id: check_files
|
||||||
@ -34,12 +59,36 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
REPO="community-scripts/ProxmoxVE"
|
REPO="community-scripts/ProxmoxVE"
|
||||||
API_URL="https://api.github.com/repos/$REPO/contents"
|
API_URL="https://api.github.com/repos/$REPO/contents"
|
||||||
|
TITLE="${{ env.TITLE }}"
|
||||||
|
SCRIPT_TYPE="${{ env.SCRIPT_TYPE }}"
|
||||||
|
|
||||||
FILES=(
|
# Define files based on script type
|
||||||
"ct/${TITLE}.sh"
|
case "$SCRIPT_TYPE" in
|
||||||
"install/${TITLE}-install.sh"
|
ct)
|
||||||
"frontend/public/json/${TITLE}.json"
|
FILES=(
|
||||||
)
|
"ct/${TITLE}.sh"
|
||||||
|
"install/${TITLE}-install.sh"
|
||||||
|
"frontend/public/json/${TITLE}.json"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
FILES=(
|
||||||
|
"vm/${TITLE}.sh"
|
||||||
|
"frontend/public/json/${TITLE}.json"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
FILES=(
|
||||||
|
"tools/addon/${TITLE}.sh"
|
||||||
|
"frontend/public/json/${TITLE}.json"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
FILES=(
|
||||||
|
"tools/pve/${TITLE}.sh"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
EXISTS=false
|
EXISTS=false
|
||||||
for FILE in "${FILES[@]}"; do
|
for FILE in "${FILES[@]}"; do
|
||||||
@ -61,46 +110,79 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
branch="delete_files"
|
TITLE="${{ env.TITLE }}"
|
||||||
|
SCRIPT_TYPE="${{ env.SCRIPT_TYPE }}"
|
||||||
|
branch="delete_files_${TITLE}"
|
||||||
|
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
rm -f ct/${TITLE}.sh
|
|
||||||
rm -f install/${TITLE}-install.sh
|
# Delete files based on script type
|
||||||
rm -f frontend/public/json/${TITLE}.json
|
case "$SCRIPT_TYPE" in
|
||||||
|
ct)
|
||||||
|
rm -f "ct/${TITLE}.sh"
|
||||||
|
rm -f "ct/headers/${TITLE}"
|
||||||
|
rm -f "install/${TITLE}-install.sh"
|
||||||
|
rm -f "frontend/public/json/${TITLE}.json"
|
||||||
|
# Also try alpine variant
|
||||||
|
if [[ "$TITLE" == alpine-* ]]; then
|
||||||
|
stripped="${TITLE#alpine-}"
|
||||||
|
rm -f "frontend/public/json/${stripped}.json"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
rm -f "vm/${TITLE}.sh"
|
||||||
|
rm -f "frontend/public/json/${TITLE}.json"
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
rm -f "tools/addon/${TITLE}.sh"
|
||||||
|
rm -f "frontend/public/json/${TITLE}.json"
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
rm -f "tools/pve/${TITLE}.sh"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
if git diff --staged --quiet; then
|
if git diff --staged --quiet; then
|
||||||
echo "No files to delete. Exiting..."
|
echo "No files to delete. Exiting..."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
git commit -m "Deleted files for issue: ${{ github.event.issue.title }}"
|
|
||||||
git push origin $branch --force
|
|
||||||
gh pr create --title "Delete Files for ${{ github.event.issue.title }} after Merge to Main" --body "Delete files after merge in main repo." --base main --head $branch
|
|
||||||
|
|
||||||
pr_number=$(gh pr list | grep -m 1 $branch | awk '{print $1}')
|
git commit -m "Delete ${TITLE} (${SCRIPT_TYPE}) after migration to ProxmoxVE"
|
||||||
#gh pr merge $pr_number --squash
|
git push origin $branch --force
|
||||||
echo pr_number=$pr_number >> $GITHUB_ENV
|
|
||||||
|
gh pr create \
|
||||||
|
--title "Delete ${TITLE} after Merge to Main" \
|
||||||
|
--body "Automated cleanup: Delete ${TITLE} (${SCRIPT_TYPE}) files after successful migration to ProxmoxVE main repo." \
|
||||||
|
--base main \
|
||||||
|
--head $branch
|
||||||
|
|
||||||
|
pr_number=$(gh pr list --head $branch --json number --jq '.[].number')
|
||||||
|
echo "pr_number=$pr_number" >> $GITHUB_ENV
|
||||||
|
echo "branch=$branch" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Approve pull request and merge
|
- name: Approve pull request and merge
|
||||||
if: env.changed == 'true'
|
if: env.pr_number != ''
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ steps.generate-token-merge.outputs.token }}
|
GH_TOKEN: ${{ steps.generate-token-merge.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions-automege[bot]"
|
git config --global user.name "github-actions-automerge[bot]"
|
||||||
git config --global user.email "github-actions-automege[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions-automerge[bot]@users.noreply.github.com"
|
||||||
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
|
PR_NUMBER="${{ env.pr_number }}"
|
||||||
if [ -n "$PR_NUMBER" ]; then
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
gh pr review $PR_NUMBER --approve
|
gh pr review $PR_NUMBER --approve
|
||||||
gh pr merge $PR_NUMBER --squash --admin
|
gh pr merge $PR_NUMBER --squash --admin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Comment on Issue
|
- name: Comment on Issue
|
||||||
|
if: env.pr_number != ''
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const issue_number = context.payload.issue.number;
|
const issue_number = context.payload.issue.number;
|
||||||
|
|
||||||
const message = `Files deleted with PR #${process.env.pr_number}`;
|
const message = `Files deleted with PR #${process.env.pr_number}`;
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
|
|||||||
246
.github/workflows/move-to-main-repo.yaml
vendored
246
.github/workflows/move-to-main-repo.yaml
vendored
@ -34,63 +34,128 @@ jobs:
|
|||||||
repository: community-scripts/ProxmoxVED
|
repository: community-scripts/ProxmoxVED
|
||||||
token: ${{ secrets.GH_MERGE_PAT }}
|
token: ${{ secrets.GH_MERGE_PAT }}
|
||||||
|
|
||||||
- name: List Issues in Repository
|
- name: List Issues and Extract Script Type
|
||||||
id: list_issues
|
id: list_issues
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
echo "Filtering Issues with Label Migration To ProxmoxVE"
|
echo "Filtering Issues with Label Migration To ProxmoxVE"
|
||||||
raw_output=$(gh issue list --json title,labels,number)
|
raw_output=$(gh issue list --json title,labels,number,body)
|
||||||
filtered_issues=$(echo "$raw_output" | jq -r '.[] | select(.labels[]?.name == "Migration To ProxmoxVE") | .title' | head -n 1)
|
filtered_issue=$(echo "$raw_output" | jq -r '[.[] | select(.labels[]?.name == "Migration To ProxmoxVE")][0]')
|
||||||
issue_nr=$(echo "$raw_output" | jq -r '.[] | select(.labels[]?.name == "Migration To ProxmoxVE") | .number' | head -n 1)
|
|
||||||
|
|
||||||
if [ -z "$filtered_issues" ]; then
|
if [ "$filtered_issue" == "null" ] || [ -z "$filtered_issue" ]; then
|
||||||
echo "No issues found with label 'Migration To ProxmoxVE'."
|
echo "No issues found with label 'Migration To ProxmoxVE'."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
script_name=$(echo "$filtered_issues" | head -n 1) # Nur das erste Issue nehmen
|
|
||||||
script_name_lowercase=$(echo "$script_name" | tr '[:upper:]' '[:lower:]' | tr -d ' ')
|
|
||||||
echo "Script Name: $script_name_lowercase"
|
|
||||||
echo "script_name=$script_name_lowercase" >> $GITHUB_OUTPUT
|
|
||||||
echo "issue_nr=$issue_nr" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
script_name=$(echo "$filtered_issue" | jq -r '.title' | tr '[:upper:]' '[:lower:]' | tr -d ' ')
|
||||||
|
issue_nr=$(echo "$filtered_issue" | jq -r '.number')
|
||||||
|
issue_body=$(echo "$filtered_issue" | jq -r '.body')
|
||||||
|
|
||||||
|
echo "Script Name: $script_name"
|
||||||
|
echo "Issue Number: $issue_nr"
|
||||||
|
|
||||||
|
# Detect script type from issue body
|
||||||
|
if echo "$issue_body" | grep -qi "CT (LXC Container)"; then
|
||||||
|
script_type="ct"
|
||||||
|
elif echo "$issue_body" | grep -qi "VM (Virtual Machine)"; then
|
||||||
|
script_type="vm"
|
||||||
|
elif echo "$issue_body" | grep -qi "Addon (tools/addon)"; then
|
||||||
|
script_type="addon"
|
||||||
|
elif echo "$issue_body" | grep -qi "PVE Tool (tools/pve)"; then
|
||||||
|
script_type="pve"
|
||||||
|
else
|
||||||
|
# Fallback detection by filename pattern
|
||||||
|
if [[ "$script_name" == *"-vm"* ]]; then
|
||||||
|
script_type="vm"
|
||||||
|
else
|
||||||
|
script_type="ct"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Script Type: $script_type"
|
||||||
|
|
||||||
|
echo "script_name=$script_name" >> $GITHUB_OUTPUT
|
||||||
|
echo "issue_nr=$issue_nr" >> $GITHUB_OUTPUT
|
||||||
|
echo "script_type=$script_type" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Check if script files exist
|
- name: Check if script files exist
|
||||||
id: check_files
|
id: check_files
|
||||||
run: |
|
run: |
|
||||||
script_name="${{ steps.list_issues.outputs.script_name }}"
|
script_name="${{ steps.list_issues.outputs.script_name }}"
|
||||||
ct_file="ct/${script_name}.sh"
|
script_type="${{ steps.list_issues.outputs.script_type }}"
|
||||||
install_file="install/${script_name}-install.sh"
|
files_found="true"
|
||||||
json_file="frontend/public/json/${script_name}.json"
|
missing_files=""
|
||||||
|
|
||||||
|
# Check files based on script type
|
||||||
if [[ ! -f "$ct_file" ]]; then
|
case "$script_type" in
|
||||||
echo "ct file not found."
|
ct)
|
||||||
echo "files_found=false" >> $GITHUB_OUTPUT
|
if [[ ! -f "ct/${script_name}.sh" ]]; then
|
||||||
echo "missing=$ct_file" >> $GITHUB_OUTPUT
|
echo "ct file not found: ct/${script_name}.sh"
|
||||||
fi
|
files_found="false"
|
||||||
if [[ ! -f "$install_file" ]]; then
|
missing_files+="ct/${script_name}.sh "
|
||||||
echo "install file not found."
|
|
||||||
echo "files_found=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "missing=$install_file" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
if [[ ! -f "$json_file" ]]; then
|
|
||||||
if [[ "$json_file" = *alpine* ]]; then
|
|
||||||
stripped_name="${json_file/frontend\/public\/json\/alpine-/frontend/public/json/}"
|
|
||||||
echo $stripped_name
|
|
||||||
if [[ -f "$stripped_name" ]]; then
|
|
||||||
echo "files_found=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "json file striped not found."
|
|
||||||
echo "files_found=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "missing=$json_file" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
else
|
if [[ ! -f "install/${script_name}-install.sh" ]]; then
|
||||||
echo "json file not found."
|
echo "install file not found: install/${script_name}-install.sh"
|
||||||
echo "files_found=false" >> $GITHUB_OUTPUT
|
files_found="false"
|
||||||
echo "missing=$json_file" >> $GITHUB_OUTPUT
|
missing_files+="install/${script_name}-install.sh "
|
||||||
fi
|
fi
|
||||||
fi
|
# JSON check with alpine fallback
|
||||||
|
json_file="frontend/public/json/${script_name}.json"
|
||||||
|
if [[ ! -f "$json_file" ]]; then
|
||||||
|
if [[ "$script_name" == alpine-* ]]; then
|
||||||
|
stripped_name="${script_name#alpine-}"
|
||||||
|
alt_json="frontend/public/json/${stripped_name}.json"
|
||||||
|
if [[ -f "$alt_json" ]]; then
|
||||||
|
echo "Using alpine fallback JSON: $alt_json"
|
||||||
|
echo "json_fallback=$alt_json" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "json file not found: $json_file"
|
||||||
|
files_found="false"
|
||||||
|
missing_files+="$json_file "
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "json file not found: $json_file"
|
||||||
|
files_found="false"
|
||||||
|
missing_files+="$json_file "
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
if [[ ! -f "vm/${script_name}.sh" ]]; then
|
||||||
|
echo "vm file not found: vm/${script_name}.sh"
|
||||||
|
files_found="false"
|
||||||
|
missing_files+="vm/${script_name}.sh "
|
||||||
|
fi
|
||||||
|
# JSON is optional for VMs but check anyway
|
||||||
|
json_file="frontend/public/json/${script_name}.json"
|
||||||
|
if [[ ! -f "$json_file" ]]; then
|
||||||
|
echo "json file not found (optional): $json_file"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
if [[ ! -f "tools/addon/${script_name}.sh" ]]; then
|
||||||
|
echo "addon file not found: tools/addon/${script_name}.sh"
|
||||||
|
files_found="false"
|
||||||
|
missing_files+="tools/addon/${script_name}.sh "
|
||||||
|
fi
|
||||||
|
# JSON is optional for addons
|
||||||
|
json_file="frontend/public/json/${script_name}.json"
|
||||||
|
if [[ ! -f "$json_file" ]]; then
|
||||||
|
echo "json file not found (optional): $json_file"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
if [[ ! -f "tools/pve/${script_name}.sh" ]]; then
|
||||||
|
echo "pve tool file not found: tools/pve/${script_name}.sh"
|
||||||
|
files_found="false"
|
||||||
|
missing_files+="tools/pve/${script_name}.sh "
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "files_found=$files_found" >> $GITHUB_OUTPUT
|
||||||
|
echo "missing=$missing_files" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Comment if not all Files found
|
- name: Comment if not all Files found
|
||||||
if: steps.check_files.outputs.files_found == 'false'
|
if: steps.check_files.outputs.files_found == 'false'
|
||||||
@ -98,7 +163,8 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
script_name="${{ steps.list_issues.outputs.script_name }}"
|
script_name="${{ steps.list_issues.outputs.script_name }}"
|
||||||
gh issue comment ${{ steps.list_issues.outputs.issue_nr }} --body "Not all required files were found for $script_name. Please check the files and try again. Missing: ${{ steps.check_files.outputs.missing }}."
|
script_type="${{ steps.list_issues.outputs.script_type }}"
|
||||||
|
gh issue comment ${{ steps.list_issues.outputs.issue_nr }} --body "Not all required files were found for **$script_name** (type: $script_type). Please check the files and try again. Missing: ${{ steps.check_files.outputs.missing }}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
- name: Get GitHub App User ID
|
- name: Get GitHub App User ID
|
||||||
@ -119,45 +185,78 @@ jobs:
|
|||||||
echo "Using branch: $branch_name"
|
echo "Using branch: $branch_name"
|
||||||
echo "branch_name=$branch_name" >> $GITHUB_ENV
|
echo "branch_name=$branch_name" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Clone ProxmoxVE (Target Repo)
|
- name: Clone ProxmoxVE and Copy Files
|
||||||
run: |
|
run: |
|
||||||
script_name="${{ steps.list_issues.outputs.script_name }}"
|
script_name="${{ steps.list_issues.outputs.script_name }}"
|
||||||
|
script_type="${{ steps.list_issues.outputs.script_type }}"
|
||||||
|
json_fallback="${{ steps.check_files.outputs.json_fallback }}"
|
||||||
|
|
||||||
git clone https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/community-scripts/ProxmoxVE.git ProxmoxVE
|
git clone https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/community-scripts/ProxmoxVE.git ProxmoxVE
|
||||||
cd ProxmoxVE
|
cd ProxmoxVE
|
||||||
|
|
||||||
if [[ -f "ct/${script_name}.sh" ]]; then
|
# Check if files already exist in target repo
|
||||||
echo "ct file already exists in ProxmoxVE"
|
case "$script_type" in
|
||||||
exit 1
|
ct)
|
||||||
fi
|
[[ -f "ct/${script_name}.sh" ]] && echo "ct file already exists in ProxmoxVE" && exit 1
|
||||||
if [[ -f "install/${script_name}-install.sh" ]]; then
|
[[ -f "install/${script_name}-install.sh" ]] && echo "install file already exists in ProxmoxVE" && exit 1
|
||||||
echo "install file already exists in ProxmoxVE"
|
;;
|
||||||
exit 1
|
vm)
|
||||||
fi
|
[[ -f "vm/${script_name}.sh" ]] && echo "vm file already exists in ProxmoxVE" && exit 1
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
[[ -f "tools/addon/${script_name}.sh" ]] && echo "addon file already exists in ProxmoxVE" && exit 1
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
[[ -f "tools/pve/${script_name}.sh" ]] && echo "pve tool file already exists in ProxmoxVE" && exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
git checkout -b "$branch_name"
|
git checkout -b "$branch_name"
|
||||||
|
|
||||||
cp ../ct/$script_name.sh ct/.
|
# Copy files based on script type
|
||||||
cp ../ct/headers/$script_name ct/headers/. || true
|
case "$script_type" in
|
||||||
cp ../install/$script_name-install.sh install/.
|
ct)
|
||||||
|
cp ../ct/${script_name}.sh ct/
|
||||||
|
cp ../ct/headers/${script_name} ct/headers/ 2>/dev/null || true
|
||||||
|
cp ../install/${script_name}-install.sh install/
|
||||||
|
|
||||||
json_file="${script_name}.json"
|
# Handle JSON with alpine fallback
|
||||||
|
if [[ -n "$json_fallback" ]]; then
|
||||||
if [[ ! -f "../frontend/public/json/$json_file" ]]; then
|
cp ../${json_fallback} frontend/public/json/ || true
|
||||||
if [[ "$json_file" = *alpine* ]]; then
|
else
|
||||||
stripped_name="${json_file#alpine-}"
|
cp ../frontend/public/json/${script_name}.json frontend/public/json/ 2>/dev/null || true
|
||||||
if [[ -f "../frontend/public/json/$stripped_name" ]]; then
|
|
||||||
cp ../frontend/public/json/$stripped_name frontend/public/json/. || true
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
else
|
|
||||||
cp ../frontend/public/json/$json_file frontend/public/json/. || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo $script_name
|
# Update URLs in ct script
|
||||||
sed -i "s|https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func|https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func|" ct/$script_name.sh
|
sed -i "s|https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func|https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func|" ct/${script_name}.sh
|
||||||
sed -i "s|https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func|https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func|" ct/$script_name.sh
|
sed -i "s|https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func|https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func|" ct/${script_name}.sh
|
||||||
sed -i "s|# License: MIT \| https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE|# License: MIT \| https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE|" ct/$script_name.sh
|
sed -i "s|community-scripts/ProxmoxVED|community-scripts/ProxmoxVE|g" ct/${script_name}.sh
|
||||||
sed -i "s|# License: MIT \| https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE|# License: MIT \| https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE|" install/$script_name-install.sh
|
sed -i "s|community-scripts/ProxmoxVED|community-scripts/ProxmoxVE|g" install/${script_name}-install.sh
|
||||||
|
;;
|
||||||
|
vm)
|
||||||
|
cp ../vm/${script_name}.sh vm/
|
||||||
|
cp ../frontend/public/json/${script_name}.json frontend/public/json/ 2>/dev/null || true
|
||||||
|
|
||||||
|
# Update URLs in vm script
|
||||||
|
sed -i "s|https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func|https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func|" vm/${script_name}.sh
|
||||||
|
sed -i "s|community-scripts/ProxmoxVED|community-scripts/ProxmoxVE|g" vm/${script_name}.sh
|
||||||
|
;;
|
||||||
|
addon)
|
||||||
|
mkdir -p tools/addon
|
||||||
|
cp ../tools/addon/${script_name}.sh tools/addon/
|
||||||
|
cp ../frontend/public/json/${script_name}.json frontend/public/json/ 2>/dev/null || true
|
||||||
|
|
||||||
|
# Update URLs in addon script
|
||||||
|
sed -i "s|community-scripts/ProxmoxVED|community-scripts/ProxmoxVE|g" tools/addon/${script_name}.sh
|
||||||
|
;;
|
||||||
|
pve)
|
||||||
|
mkdir -p tools/pve
|
||||||
|
cp ../tools/pve/${script_name}.sh tools/pve/
|
||||||
|
|
||||||
|
# Update URLs in pve script
|
||||||
|
sed -i "s|community-scripts/ProxmoxVED|community-scripts/ProxmoxVE|g" tools/pve/${script_name}.sh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
git add . > /dev/null 2>&1
|
git add . > /dev/null 2>&1
|
||||||
if git diff --cached --exit-code; then
|
if git diff --cached --exit-code; then
|
||||||
@ -165,7 +264,7 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git commit -m "${commit_message:-'Add new script'}"
|
git commit -m "Add ${script_name} (${script_type})"
|
||||||
|
|
||||||
- name: Push to ProxmoxVE
|
- name: Push to ProxmoxVE
|
||||||
run: |
|
run: |
|
||||||
@ -178,12 +277,13 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
script_name="${{ steps.list_issues.outputs.script_name }}"
|
script_name="${{ steps.list_issues.outputs.script_name }}"
|
||||||
|
script_type="${{ steps.list_issues.outputs.script_type }}"
|
||||||
gh pr create \
|
gh pr create \
|
||||||
--repo community-scripts/ProxmoxVE \
|
--repo community-scripts/ProxmoxVE \
|
||||||
--head "$branch_name" \
|
--head "$branch_name" \
|
||||||
--base main \
|
--base main \
|
||||||
--title "$script_name" \
|
--title "${script_name}" \
|
||||||
--body "Automated migration of $script_name from ProxmoxVED to ProxmoxVE."
|
--body "Automated migration of **${script_name}** (type: ${script_type}) from ProxmoxVED to ProxmoxVE."
|
||||||
PR_NUMBER=$(gh pr list --repo community-scripts/ProxmoxVE --head "$branch_name" --json number --jq '.[].number')
|
PR_NUMBER=$(gh pr list --repo community-scripts/ProxmoxVE --head "$branch_name" --json number --jq '.[].number')
|
||||||
echo "PR_NUMBER=$PR_NUMBER"
|
echo "PR_NUMBER=$PR_NUMBER"
|
||||||
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user