Skip to content

Commit

Permalink
Merge pull request #100 from natsuk4ze/add-workflows
Browse files Browse the repository at this point in the history
Add under dev label handler
  • Loading branch information
natsuk4ze authored Aug 17, 2023
2 parents dcfa1fa + 9acb20e commit b0df97b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/add_underdev_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Add under dev label on milestone assigned

on:
issues:
types:
- milestoned

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Add under dev label
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueNumber = context.issue.number;
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: ['🛠️ under dev']
});
35 changes: 35 additions & 0 deletions .github/workflows/remove_underdev_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Remove under dev label when PR closed

on:
pull_request:
types:
- closed

jobs:
remove-label:
runs-on: ubuntu-latest
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({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
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'
});
}

0 comments on commit b0df97b

Please sign in to comment.