Skip to content

Set API label

Set API label #4246

Workflow file for this run

name: Set API label
permissions: read-all
on:
workflow_run:
workflows: ["API changes check"]
types:
- completed
jobs:
update_labels:
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'openvinotoolkit' }}
permissions:
pull-requests: write
steps:
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@5c98f0b039f36ef966fdb7dfa9779262785ecb05 # v14
with:
run_id: ${{ github.event.workflow_run.id }}
name: api_status
- name: Get api_status
run: cat api_status.json
- name: Set output value
id: status
run: |
echo "action=$(jq -r .action api_status.json)" >> "$GITHUB_OUTPUT"
echo "pr_number=$(jq -r .pr_number api_status.json)" >> "$GITHUB_OUTPUT"
- name: Print outputs
run: echo ${{ steps.status.outputs.action }} ${{ steps.status.outputs.pr_number }}
- name: Add label
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
if: ${{ steps.status.outputs.action == 'add' }}
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
github.rest.issues.addLabels({
issue_number: ${{ steps.status.outputs.pr_number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["API"]
})
- name: Remove label
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
if: ${{ steps.status.outputs.action == 'remove' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.removeLabel({
issue_number: ${{ steps.status.outputs.pr_number }},
owner: context.repo.owner,
repo: context.repo.repo,
name: "API"
})