DEV Community

Cover image for GitHub new space shooter README — Step-by-Step Guide
Asad Hussain
Asad Hussain

Posted on

GitHub new space shooter README — Step-by-Step Guide

Hey folks!! In this post, I’ll show how I set up a GitHub Actions workflow that generates and updates a Space Shooter GIF no manual work required. The workflow runs on a schedule (daily) and can also be triggered manually, automatically committing the updated GIF back to the repository.


Setup Instructions (Step-by-Step)

STEP 1:

  • Create a Repository On GitHub (For those who don't have a README.md → New Repository → Name it (Same as your username) → Make it PUBLIC → Create it. Inside it, create README.md

STEP 2:

  • Create a folder named .github ( as shown above in the file structure ).
  • Inside it create another folder named workflows.
  • Inside it create a file name space-shooter.yml.
  • Follow the project structure given below :
.github/
└── workflows/space-shooter.yml
assets/
└── space-shooter.gif // will be created automatically
README.md // your original readme.md
Enter fullscreen mode Exit fullscreen mode

Step 3:

  • Paste the code inside the space-shooter.yml file
name: Update Space Shooter GIF

on:
  schedule:
    - cron: "0 0 * * *"
  workflow_dispatch:

permissions:
  contents: write

jobs:
  generate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Create assets directory
        run: mkdir -p assets

      - uses: czl9707/gh-space-shooter@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          output-path: assets/space-shooter.gif
          strategy: random
Enter fullscreen mode Exit fullscreen mode
  • Save the file, commit the changes and push it to the main branch (recommended)

Step 4:

RUN the workflow
  • Open the repo -> click on the action tab -> select update space shooter GIF (On the left sidebar) -> click run workflow (On the right side)
  • Wait for it to complete.

Step 5:

  • Once the workflow is completed, paste this code in your READM.md file
<p align="center">
 <img src="assets/space-shooter.gif" />
</p>
Enter fullscreen mode Exit fullscreen mode

Contact

I am open to discussing opportunities and collaborations. Connect with me:


Portfolio Link

Explore my work and professional journey: https://asadtechdev.vercel.app

Top comments (1)

Collapse
 
shouri_chakraborty_6ee5dd profile image
Shouri Chakraborty

it was really helpful