Skip to content

Commit

Permalink
update contents.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Aug 8, 2024
1 parent ca8d48b commit 3e214f0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/remove-unused-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Fetch All Issues and PRs
id: fetch_issues_prs
Expand All @@ -35,7 +35,7 @@ jobs:
});
});
return Array.from(labelsInUse);
return JSON.stringify(Array.from(labelsInUse));
result-encoding: string

- name: Fetch All Labels
Expand All @@ -50,16 +50,16 @@ jobs:
per_page: 100
});
return labels.map(label => label.name);
return JSON.stringify(labels.map(label => label.name));
result-encoding: string

- name: Remove Unused Labels
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labelsInUse = new Set(JSON.parse(github.steps.fetch_issues_prs.outputs.result));
const allLabels = JSON.parse(github.steps.fetch_labels.outputs.result);
const labelsInUse = new Set(JSON.parse(process.env.LABELS_IN_USE));
const allLabels = JSON.parse(process.env.ALL_LABELS);
const unusedLabels = allLabels.filter(label => !labelsInUse.has(label));
Expand All @@ -70,4 +70,7 @@ jobs:
name: label
});
console.log(`Deleted label: ${label}`);
}
}
env:
LABELS_IN_USE: ${{ steps.fetch_issues_prs.outputs.result }}
ALL_LABELS: ${{ steps.fetch_labels.outputs.result }}

0 comments on commit 3e214f0

Please sign in to comment.