Skip to content

Commit

Permalink
Update remove_underdev_label.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
natsuk4ze committed Aug 17, 2023
1 parent 033bb03 commit 4a12f08
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/remove_underdev_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,30 @@ on:
jobs:
remove-label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Remove under dev label from linked issue
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const prNumber = context.issue.number;
const { data: pr } = await github.rest.pulls.get({
const issueNumber = context.payload.pull_request?.issue_number;
if (!issueNumber) return;
const linkedIssues = await github.pulls.listAssociatedIssues({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
pull_number: context.payload.pull_request.number,
});
if (pr.linked_issue_url) {
const issueNumber = pr.linked_issue_url.split('/').pop();
github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
name: '🛠️ under dev'
});
for (const issue of linkedIssues.data) {
if (issue.repository.id === context.repo.id) {
await github.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
name: "🛠️ under dev",
});
}
}
github-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4a12f08

Please sign in to comment.