diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 933657b..eaacf2e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,9 @@ -name: Merge dev-abc into main +name: Merge develop2 into main on: push: branches: - - develop + - develop2 jobs: merge: @@ -12,15 +12,60 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Set up Git + - name: Generate App Token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.BOT_APP_ID }} + private-key: ${{ secrets.BOT_PRIVATE_KEY }} + + - name: Set environment variables + run: echo "GITHUB_ACTOR=${{ github.actor }}" >> $GITHUB_ENV + + - name: Set GitHub identity + run: | + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git config --global user.name "${GITHUB_ACTOR}" + + - name: Create a Pull Request from develop2 to main + id: create_pr run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" + curl -X POST \ + -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d '{ + "title": "Merge develop2 into main", + "head": "develop2", + "base": "main", + "body": "This PR merges develop2 into main." + }' \ + https://api.github.com/repos/${{ github.repository }}/pulls - - name: Merge dev-abc into main + - name: Merge Pull Request run: | - git checkout main - git pull origin main - git merge origin/dev-abc --no-ff -m "Merge dev-abc into main" - git push origin main + # Hole PR-URL + pr_url=$(curl -X GET \ + -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:develop2&base=main) + + # Debugging: Ausgabe der Antwort von curl + echo "PR Response: $pr_url" + + # Prüfe, ob ein PR gefunden wurde + pr_url=$(echo $pr_url | jq '.[0].url' -r) + + if [ "$pr_url" == "null" ]; then + echo "Kein Pull Request gefunden." + exit 1 + fi + + # PR mergen + curl -X PUT \ + -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d '{"state": "closed"}' \ + $pr_url/merge diff --git a/src/App.tsx b/src/App.tsx index 5ff47c0..f5862d6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -26,7 +26,7 @@ function App() {
- Click on the Vitessg and React logos to learn more + Click on the Vite sdfsdfsdf React losdfsdfsdgos to learn morefddddddddddd99910
> )