Update README with Releases #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update README with Releases | |
on: | |
release: | |
types: [published] | |
# Allow running this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
# Checkout the main branch. By default, GitHub Actions checks out the commit that triggered the workflow which is the release tag resulting in a detached HEAD and failing to push changes. | |
ref: main | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: pip install PyGithub | |
- name: Update README.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
run: python .github/scripts/update_readme.py | |
- name: Commit and push changes | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
git add README.md | |
git commit -m "Update README.md with latest release links" | |
git push |