Report New Player Match #12
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: Report New Player Match | |
on: | |
workflow_dispatch: | |
inputs: | |
winner_name: | |
description: 'Winner' | |
default: 'Select or edit' | |
required: true | |
type: choice | |
options: | |
- 'Brian' | |
- 'Chris' | |
- 'Chuck' | |
- 'David' | |
- 'Graham' | |
- 'Gregg' | |
- 'James' | |
- 'Jay' | |
- 'John' | |
- 'Modi' | |
- 'Somchai' | |
- 'Van' | |
- 'Vinnie' | |
- 'Walter' | |
- 'Select or edit' | |
new_winner_name: | |
description: 'New Player' | |
loser_name: | |
description: 'Loser' | |
default: 'Select or edit' | |
required: true | |
type: choice | |
options: | |
- 'Brian' | |
- 'Chris' | |
- 'Chuck' | |
- 'David' | |
- 'Graham' | |
- 'Gregg' | |
- 'James' | |
- 'Jay' | |
- 'John' | |
- 'Modi' | |
- 'Somchai' | |
- 'Van' | |
- 'Vinnie' | |
- 'Walter' | |
- 'Select or edit' | |
new_loser_name: | |
description: 'New Player' | |
match_length: | |
description: 'Length' | |
default: '5' | |
required: true | |
type: choice | |
options: | |
- '1' | |
- '3' | |
- '5' | |
- '7' | |
- '9' | |
- '11' | |
- '13' | |
- '15' | |
- '17' | |
- '19' | |
- '21' | |
- '23' | |
- '25' | |
jobs: | |
process_action_match: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repository | |
uses: actions/checkout@v4 | |
- name: Get Match Info | |
id: get_match | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const inputs = context.payload.inputs | |
const date = new Date(); | |
const formattedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; | |
var winner = inputs.winner_name; | |
if (inputs.winner_name == `Select or edit`) winner = inputs.new_winner_name | |
var loser = inputs.loser_name; | |
if (inputs.loser_name == `Select or edit`) loser = inputs.new_loser_name | |
const match_length = inputs.match_length; | |
console.log(`____________________________`); | |
console.log(`${ formattedDate } ${ winner } > ${ loser } ${ match_length }`); | |
return `|${ formattedDate }|${ winner }|${ loser }|${ match_length }|`; | |
- name: Append Match Info to Match List | |
run: | | |
echo ${{ steps.get_match.outputs.result }} >> "Match List.md" | |
- name: Update Rating List | |
run: | | |
echo "____________________________" | |
echo ${{ steps.get_match.outputs.result }} | |
chmod +x ./bigeloLin | |
./bigeloLin | |
echo "Updated Rating List!" | |
- name: Commit Changes | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add 'Match List.md' | |
git add 'README.md' | |
git commit -m '${{ steps.get_match.outputs.result }}' | |
git push |