Skip to content

feat: automate README contributors section using GitHub Actions (#10) - #11

Merged
udaycodespace merged 2 commits into
udaycodespace:mainfrom
Aryanbuha890:feat/issue-10-readme-contributors
Jul 17, 2026
Merged

feat: automate README contributors section using GitHub Actions (#10)#11
udaycodespace merged 2 commits into
udaycodespace:mainfrom
Aryanbuha890:feat/issue-10-readme-contributors

Conversation

@Aryanbuha890

Copy link
Copy Markdown
Contributor

Description

This PR addresses issue #10 by automating the maintainability of the README contributors section. A GitHub Actions workflow is implemented to run whenever a pull request is merged, updating the table with the contributor's GitHub profile name, picture, and contribution category.

Key Changes

1. Document Anchor Markers (README.md)

  • Wrapped the contributors section inside <!-- CONTRIBUTORS-START --> and <!-- CONTRIBUTORS-END --> tags, allowing the parsing script to locate and overwrite the grid dynamically without touching the rest of the file.

2. Node.js Automation Script (.github/scripts/update-contributors.js)

  • Asynchronous API Integration: Calls https://api.github.com/users/${username} to fetch the contributor's actual display name (e.g. "Aryan Buha") rather than default username handles.
  • Token Authorization: Uses GITHUB_TOKEN from the actions environment to ensure API requests do not trigger rate limits.
  • Contribution Classification: Maps PR labels and title prefixes (e.g. ui/frontend -> Frontend, docs -> Docs, fix/bug -> Bug fix, test -> Tests) to predefined categories.
  • Validations: Excludes bot accounts (e.g. dependabot[bot]) and prevents duplicates.
  • Layout Formatting: Groups elements in a professional table grid with up to 5 entries per row.

3. GitHub Actions Integration (.github/workflows/update-contributors.yml)

  • Setup event triggers for pull_request closed on the main branch, running only when .merged is true.
  • Configured stefanzweifel/git-auto-commit-action with write permissions to auto-commit and push formatting changes back to the repository.

Verification

Tested the script locally using a mock payload file:

$env:GITHUB_EVENT_PATH="C:\Users\aryan\.gemini\antigravity-ide\scratch\mock-event.json"
node .github/scripts/update-contributors.js

@github-actions

Copy link
Copy Markdown

🚨 @Aryanbuha890, pull requests modifying GitHub actions/workflows from forks are automatically closed for repository security. Maintainers will review and manually implement updates if needed.

@github-actions github-actions Bot closed this Jul 17, 2026
@udaycodespace
udaycodespace self-requested a review July 17, 2026 09:23
@udaycodespace udaycodespace reopened this Jul 17, 2026
@udaycodespace udaycodespace added ECSoC26 Required label for a PR to be eligible for Sentinel scoring ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points in review PR is up and waiting on maintainer review and removed documentation workflows labels Jul 17, 2026
@udaycodespace

Copy link
Copy Markdown
Owner

@Aryanbuha890 anchor parsing, dedup check, bot exclusion lgtm. Few things before this merges:

  1. Drop your own contributor card from the README diff. Whole point is entries get added automatically post-merge, so hand-adding yourself means we can't actually confirm the automation works. Keep the CONTRIBUTORS-START/END anchors, just leave the table alone.
  2. Add tests for getContributionType, parseExistingContributors, generateTableHTML. You exported them for this reason, so use it.
  3. Add a concurrency group to the workflow. Two merges close together will race on the README commit otherwise.
  4. Confirm all 4 checks are green, and paste your local mock-payload test output into the PR description.

Ping me once these are in, I'll take another pass. Good work so far.

@udaycodespace udaycodespace added redo Reviewed — needs changes before it can be merged and removed in review PR is up and waiting on maintainer review labels Jul 17, 2026
- Remove manual Aryanbuha890 contributor card from README; keep anchors only
- Add concurrency group to workflow to prevent race on simultaneous merges
- Add unit tests for getContributionType, parseExistingContributors, generateTableHTML
@github-actions

Copy link
Copy Markdown

🚨 @Aryanbuha890, pull requests modifying GitHub actions/workflows from forks are automatically closed for repository security. Maintainers will review and manually implement updates if needed.

@github-actions github-actions Bot closed this Jul 17, 2026
@Aryanbuha890

Copy link
Copy Markdown
Contributor Author

@udaycodespace All reviewer feedback has been addressed! Here is a detailed breakdown of the changes:

1. 🧹 Removed Manual Contributor Card from README

  • Modified README.md to remove the manually added Aryanbuha890 contributor card.
  • Preserved the <!-- CONTRIBUTORS-START --> and <!-- CONTRIBUTORS-END --> anchor tags.
  • Kept the existing Jidnyasa-P card as is. This ensures the automation can be verified from scratch post-merge.

2. 🧪 Added Unit Tests for Automation Functions

  • Created a new test suite: .github/scripts/update-contributors.test.js using Node's native assert module (no extra dependencies required).
  • Wrote 36 test cases covering:
    • getContributionType(prPayload): All label matching (frontend, ui, css, backend, api, docs, bug, test, jest, performance, security, ci, docker, a11y), title-prefix fallbacks, priority hierarchies, and the general fallback to 💻 Code.
    • parseExistingContributors(sectionContent): Empty section handling, single/multiple contributor HTML parsing, case-insensitive checks.
    • generateTableHTML(contributors): Output structures, link/avatar correctness, and proper grid wrapping (max 5 columns per row).

3. 🔄 Added Concurrency Group to Workflow

  • Modified .github/workflows/update-contributors.yml to include:
    concurrency:
      group: update-contributors
      cancel-in-progress: false
    
    

getContributionType
✅ returns 🎨 Frontend for label "frontend"
✅ returns 🎨 Frontend for label "ui"
✅ returns 🎨 Frontend for label "css"
✅ returns 💻 Code for label "backend"
✅ returns 💻 Code for label "api"
✅ returns 📖 Docs for label "docs"
✅ returns 📖 Docs for label "documentation"
✅ returns 🐛 Bug fix for label "bug"
✅ returns 🐛 Bug fix for label "fix"
✅ returns 🧪 Tests for label "test"
✅ returns 🧪 Tests for label "jest"
✅ returns ⚡ Performance for label "performance"
✅ returns 🔒 Security for label "security"
✅ returns 🚇 Infrastructure for label "ci"
✅ returns 🚇 Infrastructure for label "docker"
✅ returns ♿ Accessibility for label "a11y"
✅ label takes priority over title prefix
✅ title starting with "fix" returns 🐛 Bug fix
✅ title starting with "docs" returns 📖 Docs
✅ title starting with "test" returns 🧪 Tests
✅ title with "ui" keyword returns 🎨 Frontend
✅ generic feat title defaults to 💻 Code
✅ returns 💻 Code as ultimate fallback (no labels, unknown title)

parseExistingContributors
✅ returns empty array for empty section
✅ parses a single contributor entry correctly
✅ parses multiple contributor entries
✅ is case-insensitive for username matching (regex)

generateTableHTML
✅ returns a string
✅ contains

and
tags
✅ contains correct github profile link for contributor
✅ contains contributor avatar img
✅ contains contributor display name
✅ contains contributor role
✅ wraps into multiple rows for 6 contributors (max 5 per row)
✅ first row has exactly 5 entries for 6 contributors
✅ empty contributors array returns table with no rows

──────────────────────────────────────────────────
Results: 36 passed, 0 failed

@udaycodespace udaycodespace reopened this Jul 17, 2026
@udaycodespace

Copy link
Copy Markdown
Owner

@Aryanbuha890 lgtm — all four points addressed cleanly. Tests are solid, concurrency group looks right, README diff is clean now.

@udaycodespace udaycodespace added ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points and removed ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points redo Reviewed — needs changes before it can be merged documentation workflows labels Jul 17, 2026
@Aryanbuha890

Copy link
Copy Markdown
Contributor Author

@Aryanbuha890 lgtm — all four points addressed cleanly. Tests are solid, concurrency group looks right, README diff is clean now.

Thank you sir. 🫡

@udaycodespace

Copy link
Copy Markdown
Owner

@Aryanbuha890 lgtm — all four points addressed cleanly. Tests are solid, concurrency group looks right, README diff is clean now.

Thank you sir. 🫡

@Aryanbuha890 haha no need for "sir", Uday works fine 🙂
You did solid work here. I'll be raising a few more issues soon
Feel free to drop your approach in the comments and claim with /assign like last time.

@udaycodespace
udaycodespace merged commit 72a4afc into udaycodespace:main Jul 17, 2026
4 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot added ECSoC26-L3 Difficult, auto-assigned by Sentinel — 15 points and removed ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points labels Jul 17, 2026
@udaycodespace

Copy link
Copy Markdown
Owner

@Aryanbuha890 since this already merged, no need to reopen
closed PRs won't retrigger the workflow anyway. Two follow-ups:

  1. Can you open a small new PR with the branch fix (ref: main on checkout + branch: main on the commit step)? That's what'll make this reliable going forward.
  2. I'll add your contributor entry to the README manually for now since the automation didn't complete this time — once the fix lands we'll verify it works end-to-end on the next merge.

Good learning for both of us on how pull_request: closed events handle branch refs.

@udaycodespace udaycodespace added ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points and removed ECSoC26-L3 Difficult, auto-assigned by Sentinel — 15 points labels Jul 17, 2026
@Aryanbuha890

Copy link
Copy Markdown
Contributor Author

@udaycodespace I added comment so please assign me.

@Aryanbuha890

Copy link
Copy Markdown
Contributor Author

I not get the any points when you merge this pr.

@udaycodespace

Copy link
Copy Markdown
Owner

I not get the any points when you merge this pr.

No worries. Sometimes the Sentinel dashboard misses or delays updates. Let's wait one more day. Keep the PR link handy for now. If the points still don't show up after that, I'll help escalate it to the ECSoC team with the PR details. We'll get it checked.

@udaycodespace

udaycodespace commented Jul 19, 2026

Copy link
Copy Markdown
Owner

I not get the any points when you merge this pr.

Just to confirm, did you receive the points for PR #12?

@Aryanbuha890

Copy link
Copy Markdown
Contributor Author

I not get the any points when you merge this pr.

Just to confirm, did you receive the points for PR #12?

Yes I got it of #12.

i also completed my work of
image

image

please verify it and merge it.

@udaycodespace

Copy link
Copy Markdown
Owner

I not get the any points when you merge this pr.

Just to confirm, did you receive the points for PR #12?

Yes I got it of #12.

i also completed my work of image

image please verify it and merge it.
  1. Glad to hear you received the points for PR bug: contributors workflow fails with "invalid reference" after merge to main #12.
  2. Regarding the other screenshot, that's from a different project, so the Project Admin of that repository will review and merge it.
  3. As for PR feat: automate README contributors section using GitHub Actions (#10) #11, let's wait one more day.
  4. If the points still aren't reflected after that, I'll escalate it with the ECSoC team.

@udaycodespace udaycodespace added ECSoC26 Required label for a PR to be eligible for Sentinel scoring ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points and removed ECSoC26 Required label for a PR to be eligible for Sentinel scoring ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26-L1 Easy difficulty, auto-assigned by Sentinel — 5 points ECSoC26 Required label for a PR to be eligible for Sentinel scoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants