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: Update Game Board | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
update_game_board: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Extract move from issue | |
id: extract_move | |
if: github.event_name == 'issues' && github.event.action == 'opened' | |
run: echo "move=$(echo ${{ github.event.issue.body }} | grep -oE '[A-C][1-3]')" >> $GITHUB_OUTPUT | |
- name: Generate board and image | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'ap-south-1' | |
MOVE: ${{ steps.extract_move.outputs.move}} | |
run: node index.js | |
- name: Update README | |
run: | | |
timestamp=$(date +%s) | |
echo "![Game Board](https://tic-actions.s3.ap-south-1.amazonaws.com/game-board.png?t=${timestamp})" > temp.md | |
cat instructions.md >> temp.md | |
mv temp.md README.md | |
- name: Commit and push changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "RecursivelyBetter" | |
git add README.md | |
git commit --allow-empty -m "Update game board image" | |
git push |