From d1085ace4e98d925303b60a22fd919602147464f Mon Sep 17 00:00:00 2001 From: FonduemangVI Date: Sun, 31 Mar 2024 22:54:49 +1100 Subject: [PATCH] test auto action --- .github/scripts/update-contributors.js | 15 ++++++++++++++ .github/workflows/update_contributors.yml | 25 +++++++++++++++++++++++ CONTRIBUTORS.md | 0 3 files changed, 40 insertions(+) create mode 100644 .github/scripts/update-contributors.js create mode 100644 .github/workflows/update_contributors.yml create mode 100644 CONTRIBUTORS.md diff --git a/.github/scripts/update-contributors.js b/.github/scripts/update-contributors.js new file mode 100644 index 000000000..437750b20 --- /dev/null +++ b/.github/scripts/update-contributors.js @@ -0,0 +1,15 @@ +const fs = require('fs'); +const axios = require('axios'); + +const owner = 'FonduemangVI'; +const repo = 'Guides'; + +axios.get(`https://api.github.com/repos/${owner}/${repo}/contributors`) + .then(response => { + const contributors = response.data.map(user => `- [@${user.login}](${user.html_url})`).join('\n'); + fs.writeFileSync('CONTRIBUTORS.md', `# Contributors\n\n${contributors}\n`); + }) + .catch(error => { + console.error(error); + process.exit(1); + }); diff --git a/.github/workflows/update_contributors.yml b/.github/workflows/update_contributors.yml new file mode 100644 index 000000000..3c16fc89c --- /dev/null +++ b/.github/workflows/update_contributors.yml @@ -0,0 +1,25 @@ +name: Update contributors + +on: + push: + branches: + - main # or the default branch of your repository + +jobs: + update_contributors: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: "14" + + - name: Install dependencies + run: npm install axios + + - name: Update CONTRIBUTORS.md + run: | + node .github/scripts/update-contributors.js diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 000000000..e69de29bb