Skip to content

Update README

Update README #30

# This workflow will update the links to the latest n releases when it is called
name: Update README
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update README.md file
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LINKS=`gh api \
--header 'Accept: application/vnd.github+json' \
--header 'X-GitHub-Api-Version:2022-11-28' \
/repos/${{ github.repository }}/releases \
| jq -c '.[] | select(.name | contains("DO NOT USE") | not)' \
| jq -r '.tag_name' \
| head -n 3 \
| sed -E 's|(Release_Tag_v([^"]+))|\\* Release \2: https://github.com/${{ github.repository }}/releases/tag/\1\\\\n|' \
| paste -sd ''`
sed -i -e "/BEGIN/,/END/c\[//]: # (BEGIN)\n$LINKS\n[//]: # (END)" README.md
- name: Extract branch name
id: extract_branch
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.extract_branch.outputs.branch }}
message: Update latest releases in README.md