-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (35 loc) · 1.36 KB
/
update_readme.yml
File metadata and controls
35 lines (35 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Update README
on:
push:
paths:
- "bot/package.json"
permissions:
contents: write
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Get Versions
id: versions
run: |
DISCORD_JS=$(node -p "require('./bot/package.json').dependencies['discord.js'].replace('^','')")
DBM=$(node -p "require('./bot/package.json').version")
echo "discord_js_version=$DISCORD_JS" >> $GITHUB_OUTPUT
echo "dbm_version=$DBM" >> $GITHUB_OUTPUT
- name: Update README
run: |
sed -i "s/DiscordJS - [0-9]\+\.[0-9]\+\.[0-9]\+/DiscordJS - ${{ steps.versions.outputs.discord_js_version }}/" README.md
sed -i "s/DBM - [0-9]\+\.[0-9]\+\.[0-9]\+/DBM - ${{ steps.versions.outputs.dbm_version }}/" README.md
- name: Commit Changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "Update Discord.js and DBM versions in README" || echo "No changes to commit"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:main