diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 3714185..9532aa4 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -120,27 +120,32 @@ jobs: github.ref_name != 'main' && github.ref_name != 'develop' && (startsWith(github.ref_name, 'dev-') || startsWith(github.ref_name, 'feature/')) + # Примечание: Для создания PR из той же ветки нужен PAT (Personal Access Token) + # Создайте PAT с правами repo и добавьте в Secrets как PAT permissions: contents: write pull-requests: write + issues: write steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + persist-credentials: true - name: Check if PR already exists id: check-pr uses: actions/github-script@v6 with: + github-token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} script: | const branchName = context.ref.replace('refs/heads/', ''); const { data: prs } = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, - head: `${context.repo.owner}:${branchName}`, + head: context.repo.owner + ':' + branchName, base: 'main', state: 'open' }); @@ -157,6 +162,7 @@ jobs: if: steps.check-pr.outputs.exists == 'true' uses: actions/github-script@v6 with: + github-token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} script: | const prNumber = parseInt('${{ steps.check-pr.outputs.number }}'); const branchName = context.ref.replace('refs/heads/', ''); @@ -188,6 +194,7 @@ jobs: id: create-pr uses: actions/github-script@v6 with: + github-token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} script: | const branchName = context.ref.replace('refs/heads/', '');