Have you ever wondered what your GitHub profile visitors really think about your projects? Do they love your code? Hate your documentation? Want to steal your ideas? Okay, maybe not that last one, but you get the idea!
As a developer, I wanted to create a way to collect feedback, thoughts, and opinions from my visitors without them having to create an issue. I mean, let’s be real, who doesn’t love a good chat?
So, I decided to hack my GitHub profile using a clever workflow pipeline that turns visitor thoughts into a live comment section on my README file! It’s like having a digital suggestion box, but way cooler!
When a visitor opens an issue (i.e., leaves a thought), my workflow kicks in, running a Python script that extracts the issue author’s login, title, avatar, and body. Then, it appends a beautifully formatted comment to my README file, complete with the author’s avatar and thought.
The YAML goes under .github/workflows and Python goes under the dir where your readme lives.
# hiii
name: Visitors Thoughts Workflow
on:
issues:
types: [opened]
jobs:
update-my-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
# Coffee not included, but you'll need it for this workflow
- name: Run Python Script (aka Magic Happens)
run: python runscript.py
# Where the magic happens, or where the errors occur...
- name: Update README (with a hint of drama)
run: |
# The moment of truth...
echo "${{ github.event.issue.user.login }}"
# Setting up our GitHub bot identity (no catfishing here!)
git config --local user.email github-actions[bot]
git config --local user.name
git add Readme.md
# Committing with a message that's not too confusing
git commit -m "Update README with issue owner"
# Pushing changes (please don't break, please don't break)
git push origin HEAD:main
env:
# The secret sauce (don't even think about trying to steal it!)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# If you're reading this, you're probably a developer.
# hiii
name: Visitors Thoughts Workflow
on:
issues:
types: [opened]
jobs:
update-my-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
# Coffee not included, but you'll need it for this workflow
- name: Run Python Script (aka Magic Happens)
run: python runscript.py
# Where the magic happens, or where the errors occur...
- name: Update README (with a hint of drama)
run: |
# The moment of truth...
echo "${{ github.event.issue.user.login }}"
# Setting up our GitHub bot identity (no catfishing here!)
git config --local user.email github-actions[bot]
git config --local user.name
git add Readme.md
# Committing with a message that's not too confusing
git commit -m "Update README with issue owner"
# Pushing changes (please don't break, please don't break)
git push origin HEAD:main
env:
# The secret sauce (don't even think about trying to steal it!)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# If you're reading this, you're probably a developer.
That’s all, user! done. Now, go forth and leave your witty remarks on my GitHub profile (redirect). As Linus Torvalds said, ‘I’ve finally learned to stop worrying and love the bug’ Yeah, replace that with ‘README updates’ and you’ve got my life. Thanks for sticking around, and don’t forget to roast me in the comments(just kidding) .
REPO link: https://github.com/Ronak-Ronu/Ronak-Ronu
Credits: https://github.com/Ronak-Ronu
Happy Learning.
Top comments (0)