continue workflow only if the label is present

This commit is contained in:
Naman Malhotra 2024-09-17 18:55:09 +05:30
parent 67a0209331
commit ca3aad0313
1 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,15 @@ jobs:
script: |
const pullRequestUrl = context.payload.pull_request.url;
const prDetails = await github.request(pullRequestUrl);
const labels = prDetails.data.labels.map(label => label.name);
console.log('Labels:', labels);
if (!labels.includes('cherry pick to trunk')) {
console.log('Label "cherry pick to trunk" not found. Exiting job.');
process.exit(0);
}
core.setOutput('base_ref', prDetails.data.base.ref);
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}