Skip to content

Create add_reponame_issue_label.yml #4

Create add_reponame_issue_label.yml

Create add_reponame_issue_label.yml #4

name: Add repo name to issue label
on:
issues:
pull_request:
jobs:
add-label:
runs-on: ubuntu-latest
steps:
- name: add label
uses: actions/github-script@v6
with:
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
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]
})