|
@@ -1,69 +1,16 @@
|
|
|
-name: Contributors List
|
|
|
-
|
|
|
on:
|
|
|
- workflow_dispatch:
|
|
|
-
|
|
|
- schedule:
|
|
|
- - cron: "0 1 * * *"
|
|
|
+ push:
|
|
|
+ branches:
|
|
|
+ - rolling
|
|
|
|
|
|
jobs:
|
|
|
- contributors:
|
|
|
- permissions:
|
|
|
- contents: write
|
|
|
- pull-requests: write
|
|
|
-
|
|
|
- runs-on: ubuntu-latest
|
|
|
-
|
|
|
- steps:
|
|
|
- - name: Checkout code
|
|
|
- uses: actions/checkout@v3.5.0
|
|
|
- with:
|
|
|
- fetch-depth: 0
|
|
|
- ref: ${{ github.event.repository.default_branch }}
|
|
|
-
|
|
|
- - name: Generate contributors list
|
|
|
- run: |
|
|
|
- echo '<a href="https://github.com/neon-mmd/websurfx/graphs/contributors">' >> contributors_list.html
|
|
|
- echo ' <img src="https://contrib.rocks/image?repo=neon-mmd/websurfx" />' >> contributors_list.html
|
|
|
- echo '</a>' >> contributors_list.html
|
|
|
- shell: bash
|
|
|
-
|
|
|
- - name: Create .github/assets directory
|
|
|
- run: mkdir -p .github/assets
|
|
|
-
|
|
|
- - name: Commit changes
|
|
|
- uses: actions/github-script@v5
|
|
|
- with:
|
|
|
- script: |
|
|
|
- const fs = require('fs');
|
|
|
- const filePath = '.github/assets/contributors_list.html';
|
|
|
- const content = fs.readFileSync(filePath, 'utf8');
|
|
|
-
|
|
|
- const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
|
|
|
- const owner = context.repo.owner;
|
|
|
- const repo = context.repo.repo;
|
|
|
- const branch = 'workflow/update-contributors-list';
|
|
|
-
|
|
|
- const existingFile = await octokit.rest.repos.getContent({
|
|
|
- owner,
|
|
|
- repo,
|
|
|
- path: filePath,
|
|
|
- ref: branch,
|
|
|
- });
|
|
|
-
|
|
|
- const sha = existingFile.data.sha;
|
|
|
-
|
|
|
- await octokit.rest.repos.createOrUpdateFileContents({
|
|
|
- owner,
|
|
|
- repo,
|
|
|
- path: filePath,
|
|
|
- message: 'chore: update contributors-list',
|
|
|
- content: Buffer.from(content).toString('base64'),
|
|
|
- branch,
|
|
|
- sha,
|
|
|
- });
|
|
|
-
|
|
|
- - name: Push changes
|
|
|
- run: git push origin workflow/update-contributors-list
|
|
|
- env:
|
|
|
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
+ contrib-readme-job:
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ name: A job to automate contrib in readme
|
|
|
+ steps:
|
|
|
+ - name: Contribute List
|
|
|
+ uses: akhilmhdh/contributors-readme-action@v2.3.6
|
|
|
+ with:
|
|
|
+ use_username: true
|
|
|
+ env:
|
|
|
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|