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