-
Notifications
You must be signed in to change notification settings - Fork 839
45 lines (41 loc) · 1.99 KB
/
new_game.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
37
38
39
40
41
42
43
44
45
name: Add New Game Label
on:
issues:
types:
- opened
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check if issue title contains "New Game"
id: check_title
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const issueTitle = context.payload.issue.title;
const isNewGame = issueTitle.includes('New game');
console.log(`Issue title: ${issueTitle}`);
console.log(`Is New Game: ${isNewGame}`);
console.log(`Issue Number: ${context.payload.issue.number}`);
console.log(`Issue State: ${context.payload.issue.state}`);
console.log(`Issue URL: ${context.payload.issue.html_url}`);
console.log(`Repository: ${context.repo.owner}/${context.repo.repo}`);
console.log(`Repository URL: ${context.payload.repository.html_url}`);
console.log(`Repository Full Name: ${context.payload.repository.full_name}`);
console.log(`Repository Name: ${context.payload.repository.name}`);
console.log(`Repository Owner: ${context.payload.repository.owner.login}`);
console.log(`Repository Owner URL: ${context.payload.repository.owner.html_url}`);
console.log(`Event Name: ${context.eventName}`);
core.setOutput('is_new_game', isNewGame.toString());
- name: Add "New Game" label
if: steps.check_title.outputs.is_new_game == 'true'
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const { owner, repo, number } = context.issue;
const label = 'New Game 🎮';
const level_label='level3';
await github.issues.addLabels({ owner, repo, issue_number: number, labels: [label,level_label] });
console.log(`Added label "${label}" to the issue.`);