Use curl instead of wget

This commit is contained in:
CanbiZ
2025-03-24 12:00:56 +01:00
parent 6c199a2307
commit 9d0b930db8
36 changed files with 2074 additions and 2078 deletions

View File

@@ -7,7 +7,7 @@ on:
permissions:
issues: write
jobs:
post_to_discord:
runs-on: ubuntu-latest
@@ -24,15 +24,15 @@ jobs:
run: |
REPO="community-scripts/ProxmoxVED"
API_URL="https://api.github.com/repos/$REPO/contents"
FILES=(
"ct/${{ env.TITLE }}.sh"
"install/${{ env.TITLE }}-install.sh"
"frontend/public/json/${{ env.TITLE }}.json"
)
EXISTING_FILES=()
for FILE in "${FILES[@]}"; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GH_TOKEN" "$API_URL/$FILE")
if [ "$STATUS" -eq 200 ]; then
@@ -48,26 +48,26 @@ jobs:
id: create_message
run: |
VAR="The ${{ env.TITLE }} script is ready for testing:\n"
VAR+="\`\`\`bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${{ env.TITLE }}.sh)\"\`\`\`\n"
VAR+="\`\`\`bash -c \"\$(curl -fsSL - https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${{ env.TITLE }}.sh)\"\`\`\`\n"
if [[ " ${EXISTING_FILES[@]} " =~ " frontend/public/json/${TITLE}.json " ]]; then
JSON=$(wget -qLO - https://github.com/community-scripts/ProxmoxVED/raw/main/frontend/public/json/${{ env.TITLE }}.json)
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+="Default credentials:\n"
if [[ -n "$username" && "$username" != "null" ]]; then
VAR+="Username: $username\n"
fi
if [[ -n "$password" && "$password" != "null" ]]; then
VAR+="Password: $password\n"
fi
VAR+="\n"
fi
if [ ${#notes_array[@]} -gt 0 ]; then
for note in "${notes_array[@]}"; do
VAR+="$note\n"
@@ -79,7 +79,7 @@ jobs:
VAR+="Discussion & issue tracking:\n"
VAR+="${{ github.event.issue.html_url }}"
echo "message=$VAR" >> $GITHUB_ENV
- name: Create a forumpost in Discord
id: post_to_discord
env:
@@ -90,12 +90,12 @@ jobs:
run: |
JSON_PAYLOAD=$(jq -n --arg name "Wanted Tester for $TITLE" --arg content "$MESSAGE" '{name: $name, message: {content: $content | gsub("\\\\n"; "\n")}, applied_tags: []}')
echo "JSON Payload: $JSON_PAYLOAD"
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://discord.com/api/v10/channels/$DISCORD_CHANNEL_ID/threads" \
-H "Authorization: Bot $DISCORD_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD")
STATUS_CODE=$(echo "$RESPONSE" | tail -n 1)
if [ "$STATUS_CODE" -eq 201 ]; then
echo "Discord post created successfully!"
@@ -104,7 +104,7 @@ jobs:
echo "Failed to create Discord post! Status code: $STATUS_CODE"
exit 1
fi
- name: Comment on Issue
id: comment_on_issue
env:

View File

@@ -184,7 +184,7 @@ build_container() {
echo "Container ID: $CTID"
# This executes create_lxc.sh and creates the container and .conf file
bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/.github/workflows/scripts/app-test/pr-create-lxc.sh)"
bash -c "$(curl -fsSL - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/.github/workflows/scripts/app-test/pr-create-lxc.sh)"
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
if [ "$CT_TYPE" == "0" ]; then
@@ -257,4 +257,4 @@ EOF'
description() {
IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1)
}
}