name: Move new Scripts to Main Repository on: workflow_dispatch: jobs: move-to-main-repo: runs-on: ubuntu-latest permissions: contents: write pull-requests: write actions: write steps: - name: Generate a token id: generate-token uses: actions/create-github-app-token@v1 with: app-id: ${{ vars.APP_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Checkout repository uses: actions/checkout@v4 with: ref: main - name: List Issues in Repository id: list_issues env: GH_TOKEN: ${{ github.token }} run: | echo "Filtering Issues with Label MigrationTest" raw_output=$(gh issue list --json title,labels) echo "$raw_output" filtered_issues=$(echo "$raw_output" | jq -r '.[] | select(.labels[]?.name == "MigrationTest") | .title') if [ -z "$filtered_issues" ]; then echo "No issues found with label 'MigrationTest'." else echo "Found script names with 'MigrationTest' label:" echo "$filtered_issues" for script_name in $filtered_issues; do echo "Processing: $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 done fi - name: Check if script files exist id: check_files run: | 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." echo "files_found=true" >> $GITHUB_ENV else echo "Not all required files were found." echo "files_found=false" >> $GITHUB_ENV fi - name: Configure Git user run: | git config --global user.email "github-actions@github.com" git config --global user.name "GitHub Actions" - name: Tets uses: nkoppel/push-files-to-another-repository@v1.1.4 env: API_TOKEN_GITHUB: ${{ secrets.MAIN_REPO_WF }} with: source-files: "ct/${{ env.script_name }}.sh,install/${{ env.script_name }}-install.sh,json/${{ env.script_name }}.json" destination-repository: "community-scripts/ProxmoxVE" destination-branch: "main" commit-message: "Add script files for ${{ env.script_name }}" destination-username: "github-actions" commit-email: "github-actions@github.com" commit-username: "GitHub Actions"