-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
36 lines (34 loc) · 1.28 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: label-issue-repo-name
description: "Label issues & PRs with the repository name"
author: "Vishal Koparde"
inputs:
github-token:
description: "GitHub Actions token (e.g. { github.token })"
required: true
runs:
using: "composite"
steps:
- name: add label
uses: actions/github-script@v6
with:
github-token: ${{ inputs.github-token }}
script: |
try {
const response = await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: context.repo.repo,
color: 'B60205',
description: 'RepoName'
});
console.log('LABEL ' + context.repo.repo + ' CREATED SUCCESSFULLY');
} catch (createLabelError) {
console.log('FAILED TO CREATE LABEL ' + context.repo.repo + ' ... MAY BE IT ALREADY EXISTS.');
console.log('FAILURE MSG: ' + createLabelError.message);
}
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [context.repo.repo]
})