From 6a87aba65322bcb9dac711875a1c07c1d48cda47 Mon Sep 17 00:00:00 2001 From: Amir Babaei Date: Thu, 28 Dec 2023 14:31:44 +0100 Subject: [PATCH] Update development_workflow.yml changes the method for pr --- .github/workflows/development_workflow.yml | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/development_workflow.yml b/.github/workflows/development_workflow.yml index 7eecf18..7158d33 100644 --- a/.github/workflows/development_workflow.yml +++ b/.github/workflows/development_workflow.yml @@ -5,6 +5,9 @@ on: branches: - development +permissions: + pull-requests: write # Grants permission to create pull requests + jobs: build-test-and-merge: runs-on: ubuntu-latest @@ -27,20 +30,17 @@ jobs: # Replace with your actual test command, e.g., pytest echo "Running tests!" - - name: Checkout development branch - uses: actions/checkout@v2 - with: - ref: 'development' - - - name: Auto-merge to main if tests pass - if: ${{ success() }} - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.MY_PERSONAL_TOKEN }} - branch: update-from-development-${{ github.run_id }} # Unique branch for the PR - commit-message: Merge development into main - title: '[AUTO-MERGE] Merge from Development to Main' - body: | - This is an automated pull request to update from branch development to main. - base: main # The target branch for the PR - labels: automerge + - name: Setup GitHub CLI + run: | + sudo apt update && sudo apt install -y gh # Installs the GitHub CLI + + - name: Authenticate GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Uses the built-in GITHUB_TOKEN for authentication + run: | + gh auth setup-git # Configures git to use 'gh' as a credential helper + + - name: Create or Update Pull Request + run: | + gh_pr_up() { gh pr create $* || gh pr edit $* } # Defines a function to create or update a PR + gh_pr_up --title "My pull request" --body "Description" # Uses the function to create/update a PR