preface
A well-known programmer shared a boiling point with us over the weekend:
The following queries were sent in passing:
Then I followed my thinking and asked for specific requirements:
As a result, I read the GitHub API documentation and realized that there are ways to stop whoremongers. We can make the open issue automatically closed and locked when there is no star or fork.
Let’s do it. No whoring. Start with me.
(Open source in Fluttercandies /no-free-usage-action and published in Actions market: No Free Usage Action)
The development work
Implementation approach
- Start with GitHub actions and invoke our actions through issue opening and re-opening events.
- Get the trigger of the event and read whether the TA is star, fork, or both.
- If the condition is met, send guidance information through action to close and lock the issue.
Technology selection
The best language for GitHub Action is JS/TS, but THIS time I opted for the old Dart. You guess why ~ guess right I won’t tell you.
Call various requests based on GitHub REST API.
The development process
I won’t go into the development process here, but it’s essentially just a few API calls. There are a few potholes involved, but the overall implementation is simple.
How to use it?
If your project is already open source on GitHub and you want to use this handy gadget, follow these steps:
Using the step
-
Create a yML file in the /.github/workflows folder of your project, such as checker.yml.
-
In the file, reference the action and use it.
name: No Free usage issue checker # Action name. You can customize on: issues: types: [opened.reopened] # called when the issue opens and re-opens jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: fluttercandies/no-free-usage-action@master Use the latest version of action - name: Check issue actor Step name. It can be customized. with: token: The ${{ secrets.GITHUB_TOKEN }} # Temporary Token provided by GitHub, must be passed here, and must be this value. Copy the code
-
I got a white hooker on my ass. 👀
The actual effect
Action starts when a whacker comes to your warehouse and issues an issue to you.
White piao strange was immediately taken compulsory measures, big happy people.
More usage
You can choose if you want fork or if you want star, but you have to do either.
- uses: fluttercandies/no-free-usage-action@master
- name: Check issue actor
with:
token: The ${{ secrets.GITHUB_TOKEN }}
forked: '--no-forked' (means no fork is required)
starred: '--no-starred' (Star is not required)
words: 'No whoring, please! ' (Anything. Escape single quotation marks.)
Copy the code
The latter
White piao monster has become a cancer in the industry. Everyone has more or less had white piao behavior, this is not the key issue, the key is in the process of white piao, the content and the efforts of developers without any respect, but also further white piao.
** One star, one fork, represents an endorsement of the open source developer’s content. Read the project documentation carefully and respect the content. Put forward new demand, should be the output after deep thinking. ** But some developers who don’t have a bottom line, push that bottom line again and again until confident open source developers give up and don’t open source new projects. And they will just move on to the next one and continue their white whoring activities.
So, no white whoring, start with me.
conclusion
Thanks for meeting a group of friends who support open source and have a good open source spirit during the development of Flutter Candies this year. Together, they promoted the growth of Flutter Candies.
Welcome to joinFlutter CandiesTo produce the lovely Flutter candies.