[CHESS] #55
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: "FirstComment" | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
move: | |
runs-on: ubuntu-latest | |
if: startsWith(github.event.issue.title, '[CHESS]') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Randomize Player Color | |
id: color | |
run: | | |
res=$(($RANDOM%2)) | |
if [[ ${res} -eq 0 ]]; then | |
echo "white=${{ github.event.repository.owner.login }}" >> $GITHUB_OUTPUT | |
echo "black=${{ github.event.issue.user.login }}" >> $GITHUB_OUTPUT | |
elif [[ ${res} -eq 1 ]]; then | |
echo "white=${{ github.event.issue.user.login }}" >> $GITHUB_OUTPUT | |
echo "black=${{ github.event.repository.owner.login }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Add Comment w/Player Pieces | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
## New Game! | |
### @${{ steps.color.outputs.white }} (White) // @${{ steps.color.outputs.black }} (Black) | |
- name: Create initial board | |
id: board | |
run: | | |
BOARD="$(python3 ./scripts/fen2md.py 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' | python3 ./scripts/replace_images.py)" | |
echo "board<<EOF" >> "$GITHUB_OUTPUT" | |
echo "$BOARD" >> "$GITHUB_OUTPUT" | |
echo "EOF" >> "$GITHUB_OUTPUT" | |
- name: Add Comment w/Board | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
## Board | |
### White to Move | |
`rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1` | |
${{ steps.board.outputs.board }} |