Skip to content
name: Labelling when code review completed
on:
pull_request:
branches:
- dev
jobs:
if: false

Check failure on line 9 in .github/workflows/labelling-when-code-review-completed.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/labelling-when-code-review-completed.yml

Invalid workflow file

You have an error in your yaml syntax on line 9
labelling:
## if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: false
fetch-depth: 0
- name: Prepare environment
uses: ./.github/actions/prepare-environment
- name: Get package name when dirty
id: packages_name
run: |
## jq -c '[.[] | .name]
## Получаем данные в формате ["@salutejs/plasma-new-hope","@salutejs/sdds-cs"]
echo "PACKAGES_NAME=$(npx lerna la --json --since=$(git merge-base --fork-point origin/dev) --exclude-dependents | jq -c '[.[] | .name]')" >> "$GITHUB_OUTPUT"
- name: Add label
id: data
uses: actions/github-script@v7
env:
DATA: ${{ steps.packages_name.outputs.PACKAGES_NAME }}
with:
script: |
const data = JSON.parse(process.env.DATA || []) ;
if (!data.length) {
console.log('Empty state');
return '';
}
const labels = data
.map((item) => item.replace('@salutejs/', ''))
.map((item) => {
if (item === 'plasma-new-hope') {
return 'core';
}
return item;
});
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels,
})