Skip to content

Migrate populate_contributors.py to Python 3 and add automated monthly update workflow#1

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/update-populate-contributors-script
Draft

Migrate populate_contributors.py to Python 3 and add automated monthly update workflow#1
Copilot wants to merge 5 commits intomasterfrom
copilot/update-populate-contributors-script

Conversation

Copy link

Copilot AI commented Oct 26, 2025

The populate_contributors.py script uses Python 2's deprecated urllib2 module. This PR migrates it to Python 3 and adds a GitHub Actions workflow to automatically update the contributors table in the apps-android-commons README monthly.

Changes

Python 3 Migration

  • Replace urllib2 with urllib.request in populate_contributors.py
  • Add User-Agent header to avoid 403 errors from GitHub API

New update_readme.py Script

  • Standalone script to surgically replace only the Contributors table in README
  • Pattern matches between ## Contributors ## and .. and [many more] markers
  • Error handling with validation that target section exists before updating

Automated Workflow

  • Runs 1st of each month at 00:00 UTC via cron
  • Fetches contributors from GitHub API, generates markdown table, updates apps-android-commons README
  • Supports manual triggering via workflow_dispatch
  • Requires PAT_TOKEN secret with write access to target repository
on:
  schedule:
    - cron: '0 0 1 * *'
  workflow_dispatch:

Setup Required

Add a repository secret PAT_TOKEN with permissions to push to commons-app/apps-android-commons.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/commons-app/apps-android-commons/contributors
    • Triggering command: python populate_contributors.py (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt
  • update the populate_contributors.py script to use urllib.request instead of urllib2
  • create a github workflow that we could run to modify the README directly at https://github.com/commons-app/apps-android-commons.
  • add a cron job in the workflow that runs every month and shows the latest list of contributors.
  • Here's how the README looks like, ensure the workflow just changes the Contributors table:
# Wikimedia Commons Android app
![GitHub issue custom search](https://img.shields.io/github/issues-search?label=%22good%20first%20issue%22%20issues&query=repo%3Acommons-app%2Fapps-android-commons%20is%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22)
[![Build status](https://github.com/commons-app/apps-android-commons/actions/workflows/android.yml/badge.svg?branch=main)](https://github.com/commons-app/apps-android-commons/actions?query=branch%3Amain)
[![Preview the app](https://img.shields.io/badge/Preview-Appetize.io-orange.svg)](https://appetize.io/app/8ywtpe9f8tb8h6bey11c92vkcw)
[![codecov](https://codecov.io/gh/commons-app/apps-android-commons/branch/master/graph/badge.svg)](https://codecov.io/gh/commons-app/apps-android-commons)

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons. Download the app [here][1], or view our [website][2].

Initially started by the Wikimedia Foundation, this app is now maintained by grantees and volunteers of the Wikimedia community. Anyone is welcome to improve it, just choose among the [open issues][3] and send us a pull request! :-) 

<a href="https://f-droid.org/repository/browse/?fdid=fr.free.nrw.commons" target="_blank">
<img src="https://upload.wikimedia.org/wikipedia/commons/archive/9/96/20200131184248%21%22Get_it_on_F-droid%22_Badge.png" alt="Get it on F-Droid" height="90"/></a>
<a href="https://play.google.com/store/apps/details?id=fr.free.nrw.commons" target="_blank">
<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" alt="Get it on Google Play" height="90"/></a>

## Documentation

Our [documentation repository][4] contains extensive documentation for users, contributors, and developers alike:

* [User Documentation][5]
* [Contributor Documentation][6]
  * [Volunteers Welcome!][7]
* [Developer Documentation][8]
  * [Libraries Used][9]

## Contributors ##

Thank you all for your work!

| [<img src="https://avatars.githubusercontent.com/u/3611199?v=4" width="100px;"/><br /><sub><b>misaochan</b></sub>](https://github.com/misaochan) | [<img src="https://avatars.githubusercontent.com/u/24829418?v=4" width="100px;"/><br /><sub><b>translatewiki</b></sub>](https://github.com/translatewiki) | [<img src="https://avatars.githubusercontent.com/u/3127881?v=4" width="100px;"/><br /><sub><b>neslihanturan</b></sub>](https://github.com/neslihanturan) | [<img src="https://avatars.githubusercontent.com/u/30430?v=4" width="100px;"/><br /><sub><b>yuvipanda</b></sub>](https://github.com/yuvipanda) | [<img src="https://avatars.githubusercontent.com/u/99590?v=4" width="100px;"/><br /><sub><b>nicolas-raoul</b></sub>](https://github.com/nicolas-raoul) |
| :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars.githubusercontent.com/u/407647?v=4" width="100px;"/><br /><sub><b>psh</b></sub>](https://github.com/psh) | [<img src="https://avatars.githubusercontent.com/u/4953590?v=4" width="100px;"/><br /><sub><b>domdomegg</b></sub>](https://github.com/domdomegg) | [<img src="https://avatars.githubusercontent.com/u/3069373?v=4" width="100px;"/><br /><sub><b>maskaravivek</b></sub>](https://github.com/maskaravivek) | [<img src="https://avatars.githubusercontent.com/u/30932899?v=4" width="100px;"/><br /><sub><b>madhurgupta10</b></sub>](https://github.com/madhurgupta10) | [<img src="https://avatars.githubusercontent.com/u/17375274?v=4" width="100px;"/><br /><sub><b>ashishkumar468</b></sub>](https://github.com/ashishkumar468) |
| [<img src="https://avatars.githubusercontent.com/u/103075?v=4" width="100px;"/><br /><sub><b>bvibber</b></sub>](https://github.com/bvibber) | [<img src="https://avatars.githubusercontent.com/u/10674?v=4" width="100px;"/><br /><sub><b>whym</b></sub>](https://github.com/whym) | [<img src="https://avatars.githubusercontent.com/u/10153800?v=4" width="100px;"/><br /><sub><b>akaita</b></sub>](https://github.com/akaita) | [<img src="https://avatars.githubusercontent.com/u/12448084?v=4" width="100px;"/><br /><sub><b>sivaraam</b></sub>](https://github.com/sivaraam) | [<img src="https://avatars.githubusercontent.com/u/6900601?v=4" width="100px;"/><br /><sub><b>veyndan</b></sub>](https://github.com/veyndan) |
| [<img src="https://avatars.githubusercontent.com/u/19607555?v=4" width="100px;"/><br /><sub><b>ujjwalagrawal17</b></sub>](https://github.com/ujjwalagrawal17) | [<img src="https://avatars.githubusercontent.com/u/3358282?v=4" width="100px;"/><br /><sub><b>macgills</b></sub>](https://github.com/macgills) | [<img src="https://avatars.githubusercontent.c...

</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

Copilot AI self-assigned this Oct 26, 2025
Copilot AI and others added 4 commits October 26, 2025 08:47
Co-authored-by: RitikaPahwa4444 <83745993+RitikaPahwa4444@users.noreply.github.com>
Co-authored-by: RitikaPahwa4444 <83745993+RitikaPahwa4444@users.noreply.github.com>
Co-authored-by: RitikaPahwa4444 <83745993+RitikaPahwa4444@users.noreply.github.com>
Co-authored-by: RitikaPahwa4444 <83745993+RitikaPahwa4444@users.noreply.github.com>
Copilot AI changed the title [WIP] Update populate_contributors.py to use urllib.request Migrate populate_contributors.py to Python 3 and add automated monthly update workflow Oct 26, 2025
Copilot AI requested a review from RitikaPahwa4444 October 26, 2025 08:56
@RitikaPahwa4444
Copy link

Going through the script. The header is not really required, need to validate the rest of the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants