From c62d713a52043fa72a02fbf5c5d34dac39c04ac7 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:15:38 +0100 Subject: [PATCH 1/8] WF --- .github/workflows/move-to-main-repo.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index fc7a3a1..2f85f2e 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -1,8 +1,6 @@ name: Move new Scripts to Main Repository on: - schedule: - - cron: "1 0 * * *" # Runs daily at 00:01 UTC workflow_dispatch: jobs: From 99a8c5a62bc58a976a0abc61884a42d9b03dc7cf Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:16:15 +0100 Subject: [PATCH 2/8] WF --- .github/workflows/move-to-main-repo.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index 2f85f2e..ff013c9 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -8,6 +8,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + env: + GH_TOKEN: ${{ github.token }} steps: - name: Checkout repository uses: actions/checkout@v4 From a741dce958b856cddfddfa2f848cb22d12142b71 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:19:19 +0100 Subject: [PATCH 3/8] WF --- .github/workflows/move-to-main-repo.yaml | 39 +++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index ff013c9..843fdbb 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -18,10 +18,41 @@ jobs: id: list_issues run: | echo "Filtering Issues with Label MigrationTest" - script_name=$(gh issue list --label "MigrationTest" --json title --jq '.[0].title') # Assuming the first issue is the one you want + script_name=$(gh issue list --label "MigrationTest" --json title --jq '.[0].title') echo "Found script name: $script_name" - echo "script_name=$script_name" >> $GITHUB_ENV # Set the script name as an environment variable for later use - - name: Print Script Name + script_name_lowercase=$(echo "$script_name" | tr '[:upper:]' '[:lower:]') + echo "Lowercase script name: $script_name_lowercase" + + echo "script_name=$script_name_lowercase" >> $GITHUB_ENV + + - name: Check if script files exist run: | - echo "The script name is: ${{ env.script_name }}" + script_name="${{ env.script_name }}" + + ct_file="/ct/$script_name.sh" + install_file="/install/$script_name-install.sh" + json_file="/json/$script_name.json" + + echo "Checking for script files:" + + if [[ -f "$ct_file" ]]; then + echo "Found $ct_file" + else + echo "File not found: $ct_file" + exit 1 + fi + + if [[ -f "$install_file" ]]; then + echo "Found $install_file" + else + echo "File not found: $install_file" + exit 1 + fi + + if [[ -f "$json_file" ]]; then + echo "Found $json_file" + else + echo "File not found: $json_file" + exit 1 + fi From f921b0f9b454d289391dfd8f701015bfea96db85 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:26:21 +0100 Subject: [PATCH 4/8] WF --- .github/workflows/move-to-main-repo.yaml | 43 +++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index 843fdbb..654f14a 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -27,32 +27,43 @@ jobs: echo "script_name=$script_name_lowercase" >> $GITHUB_ENV - name: Check if script files exist + id: check_files run: | script_name="${{ env.script_name }}" + # Check if files exist under /ct, /install, and /json ct_file="/ct/$script_name.sh" install_file="/install/$script_name-install.sh" json_file="/json/$script_name.json" echo "Checking for script files:" - if [[ -f "$ct_file" ]]; then - echo "Found $ct_file" + if [[ -f "$ct_file" && -f "$install_file" && -f "$json_file" ]]; then + echo "All required files found." + echo "files_found=true" >> $GITHUB_ENV else - echo "File not found: $ct_file" - exit 1 + echo "Not all required files were found." + echo "files_found=false" >> $GITHUB_ENV fi - if [[ -f "$install_file" ]]; then - echo "Found $install_file" - else - echo "File not found: $install_file" - exit 1 - fi + - name: Create PR if files found + if: env.files_found == 'true' + run: | - if [[ -f "$json_file" ]]; then - echo "Found $json_file" - else - echo "File not found: $json_file" - exit 1 - fi + target_repo="community-scripts/ProxmoxVE" + + branch_name="add-script-$script_name" + + commit_message="Add script files for $script_name" + + 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" From f52ee94bef6ef83d06305dfdefa653eb5b6e50c5 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:26:45 +0100 Subject: [PATCH 5/8] WF --- .github/workflows/move-to-main-repo.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index 654f14a..7c9ab7f 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -32,9 +32,9 @@ jobs: script_name="${{ env.script_name }}" # Check if files exist under /ct, /install, and /json - ct_file="/ct/$script_name.sh" - install_file="/install/$script_name-install.sh" - json_file="/json/$script_name.json" + ct_file="ct/$script_name.sh" + install_file="install/$script_name-install.sh" + json_file="json/$script_name.json" echo "Checking for script files:" From 6a0d9588f49b67b64f85de8dd1aeafd3117fb69c Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:26:52 +0100 Subject: [PATCH 6/8] WF --- .github/workflows/move-to-main-repo.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index 7c9ab7f..299c6ca 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -58,9 +58,9 @@ jobs: git checkout -b "$branch_name" - cp "/ct/$script_name.sh" . - cp "/install/$script_name-install.sh" . - cp "/json/$script_name.json" . + cp "ct/$script_name.sh" . + cp "install/$script_name-install.sh" . + cp "json/$script_name.json" . git add . git commit -m "$commit_message" From b69317cf3175ba8d992b4b2ed79288997a764808 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:28:47 +0100 Subject: [PATCH 7/8] WF --- .github/workflows/move-to-main-repo.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index 299c6ca..430063d 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -32,11 +32,9 @@ jobs: script_name="${{ env.script_name }}" # Check if files exist under /ct, /install, and /json - ct_file="ct/$script_name.sh" - install_file="install/$script_name-install.sh" - json_file="json/$script_name.json" - - echo "Checking for script files:" + ct_file="ct/${script_name}.sh" + install_file="install/${script_name}-install.sh" + json_file="json/${script_name}.json" if [[ -f "$ct_file" && -f "$install_file" && -f "$json_file" ]]; then echo "All required files found." From 9ed5bf71aa732c0773d2199981aec10aee58f8d4 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 10 Mar 2025 15:30:57 +0100 Subject: [PATCH 8/8] WF --- .github/workflows/move-to-main-repo.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/move-to-main-repo.yaml b/.github/workflows/move-to-main-repo.yaml index 430063d..5d0a3dd 100644 --- a/.github/workflows/move-to-main-repo.yaml +++ b/.github/workflows/move-to-main-repo.yaml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: main - name: List Issues in Repository id: list_issues