Create a PR and Auto merge before Test deployment with GitHub Actions

  Kiến thức lập trình

We are using dev branch for dev env and main branch for test env. I need to create a auto merge PR from dev to main branch via GitHub actions once the dev environment deployment is completed. So created a job with the below script to use GitHub CLI.
I have created a token in GitHub and I am Enterprise User.
I referred the page [1]:Create pull request with github action

automatedprfortestdeployment: name: Automated PR for Test deployment runs-on: windows-latest needs: [devdeployjob] environment: test env: GH_TOKEN: ${{ github.token }} permissions: pull-requests: write steps: - name: 'Create PR' shell: pwsh run: | git --version go install golang.org/dl/go1.10.7@latest go version git clone https://github.com/cli/cli.git gh-cli cd gh-cli go run script\build.go gh version echo "Creating Automated PR to merge from feature into dev" gh pr create -B origin/main -H origin/dev --title 'Merge dev into main' --body 'Created by Github action'

Receiving the below error.

Creating Automated PR to merge from feature into dev pull request create failed: GraphQL: Unauthorized: As an Enterprise Managed User, you cannot access this content (createPullRequest) Error: Process completed with exit code 1.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT