Skip to content

WR Set PR Labels

WR Set PR Labels #3722

name: WR Set PR Labels
on:
workflow_run:
workflows: ['Set PR Labels']
types: [completed]
jobs:
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The Set PR Labels workflow failed. Please check the logs.'
- run: exit 1
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The Set PR Labels workflow succeeded. The workflow will continue.'
set-pr-labels:
needs: on-success
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: 'pr-labels'
SCRIPT_PATH: './github-actions/trigger-pr/set-pr-labels.js'
steps:
- uses: actions/checkout@v4
- id: download-artifact
name: 'Download artifact'
uses: actions/github-script@v7
with:
script: |
const { downloadLabelsArtifact } = require('${{ env.SCRIPT_PATH }}');
await downloadLabelsArtifact({ github, context }, '${{ env.ARTIFACT_NAME }}');
- id: extract-artifact
name: Extract artifact
run: unzip '${{ env.ARTIFACT_NAME }}.zip'
- id: set-pr-labels
name: 'Set labels on the pull request'
uses: actions/github-script@v7
with:
script: |
const { setLabelsOnPR } = require('${{ env.SCRIPT_PATH }}');
await setLabelsOnPR({ github, context, core }, '${{ env.ARTIFACT_NAME }}.json');