PLASMA-4068: Draft release pull request #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Labelling when code review completed | |
on: | |
pull_request: | |
branches: | |
- dev | |
jobs: | |
labelling: | |
## if: github.event.review.state == 'approved' | |
runs-on: ubuntu-latest | |
env: | |
GH_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: Formatting data | |
id: data | |
uses: actions/github-script@v7 | |
env: | |
DATA: ${{ steps.packages_name.outputs.PACKAGES_NAME }} | |
with: | |
result-encoding: string | |
script: | | |
const data = JSON.parse(process.env.DATA || []) ; | |
if (!data.length) { | |
console.log('Empty state'); | |
return ''; | |
} | |
return data | |
.map((item) => item.replace('@salutejs/', '')) | |
.map((item) => { | |
if (item === 'plasma-new-hope') { | |
return 'core'; | |
} | |
return item; | |
}) | |
.join(''); | |
- name: Add labels | |
run: | | |
gh pr edit ${{ github.event.pull_request.number }} \ | |
--add-label "${{ steps.data.outputs.result }}" |