Update move-to-main-repo.yaml
This commit is contained in:
parent
73dadd85c1
commit
2518aeb469
48
.github/workflows/move-to-main-repo.yaml
vendored
48
.github/workflows/move-to-main-repo.yaml
vendored
@ -28,10 +28,11 @@ jobs:
|
|||||||
ProxmoxVE
|
ProxmoxVE
|
||||||
ProxmoxVED
|
ProxmoxVED
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout ProxmoxVED (Source Repo)
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
|
repository: community-scripts/ProxmoxVED
|
||||||
token: ${{ secrets.GH_MERGE_PAT }}
|
token: ${{ secrets.GH_MERGE_PAT }}
|
||||||
|
|
||||||
- name: List Issues in Repository
|
- name: List Issues in Repository
|
||||||
@ -48,13 +49,11 @@ jobs:
|
|||||||
if [ -z "$filtered_issues" ]; then
|
if [ -z "$filtered_issues" ]; then
|
||||||
echo "No issues found with label 'MigrationTest'."
|
echo "No issues found with label 'MigrationTest'."
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "Found script names with 'MigrationTest' label:"
|
echo "Found script names with 'MigrationTest' label:"
|
||||||
echo "$filtered_issues"
|
echo "$filtered_issues"
|
||||||
for script_name in $filtered_issues; do
|
for script_name in $filtered_issues; do
|
||||||
echo "Processing: $script_name"
|
echo "Processing: $script_name"
|
||||||
script_name_lowercase=$(echo "$script_name" | tr '[:upper:]' '[:lower:]')
|
script_name_lowercase=$(echo "$script_name" | tr '[:upper:]' '[:lower:]')
|
||||||
echo "Lowercase script name: $script_name_lowercase"
|
|
||||||
echo "script_name=$script_name_lowercase" >> $GITHUB_ENV
|
echo "script_name=$script_name_lowercase" >> $GITHUB_ENV
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -62,7 +61,6 @@ jobs:
|
|||||||
- name: Check if script files exist
|
- name: Check if script files exist
|
||||||
id: check_files
|
id: check_files
|
||||||
run: |
|
run: |
|
||||||
|
|
||||||
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"
|
||||||
@ -80,11 +78,13 @@ jobs:
|
|||||||
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
- run: |
|
|
||||||
|
- name: Configure Git User
|
||||||
|
run: |
|
||||||
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
|
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
|
||||||
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
|
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
|
||||||
|
|
||||||
- name: Create PR if files found
|
- name: Prepare new branch for PR
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
@ -93,7 +93,6 @@ jobs:
|
|||||||
branch_name="add-script-$script_name"
|
branch_name="add-script-$script_name"
|
||||||
commit_message="Add script files for $script_name"
|
commit_message="Add script files for $script_name"
|
||||||
|
|
||||||
|
|
||||||
git checkout -b "$branch_name"
|
git checkout -b "$branch_name"
|
||||||
|
|
||||||
cp "ct/$script_name.sh" .
|
cp "ct/$script_name.sh" .
|
||||||
@ -101,21 +100,30 @@ jobs:
|
|||||||
cp "json/$script_name.json" .
|
cp "json/$script_name.json" .
|
||||||
git add .
|
git add .
|
||||||
git commit -m "$commit_message"
|
git commit -m "$commit_message"
|
||||||
git remote add upstream https://github.com/${target_repo}.git
|
|
||||||
git fetch upstream
|
|
||||||
|
|
||||||
- name: Ensure branch exists
|
- name: Clone ProxmoxVE (Target Repo)
|
||||||
run: |
|
run: |
|
||||||
git checkout -b test || git checkout test
|
git clone https://x-access-token:${{ secrets.GH_MERGE_PAT }}@github.com/community-scripts/ProxmoxVE.git ProxmoxVE
|
||||||
|
cd ProxmoxVE
|
||||||
|
git checkout -b "$branch_name"
|
||||||
|
cp ../ct/$script_name.sh .
|
||||||
|
cp ../install/$script_name-install.sh .
|
||||||
|
cp ../json/$script_name.json .
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Ensure test branch exists" || echo "No changes to commit"
|
git commit -m "$commit_message"
|
||||||
|
|
||||||
- name: Push to ProxmoxVE
|
- name: Push to ProxmoxVE
|
||||||
uses: ad-m/github-push-action@master
|
run: |
|
||||||
with:
|
cd ProxmoxVE
|
||||||
github_token: ${{ secrets.GH_MERGE_PAT }}
|
git push --no-thin origin "$branch_name"
|
||||||
repository: community-scripts/ProxmoxVE
|
|
||||||
branch: test
|
|
||||||
force: true
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: Create Pull Request in ProxmoxVE
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_MERGE_PAT }}
|
||||||
|
run: |
|
||||||
|
gh pr create \
|
||||||
|
--repo community-scripts/ProxmoxVE \
|
||||||
|
--head "$branch_name" \
|
||||||
|
--base main \
|
||||||
|
--title "Migrate $script_name to ProxmoxVE" \
|
||||||
|
--body "Automated migration of $script_name from ProxmoxVED to ProxmoxVE."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user