[New game]: Path Finder Challenge #2742
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.`); |