Skip to content

update-best-of-list #64

update-best-of-list

update-best-of-list #64

# Based on https://github.com/best-of-lists/best-of-update-action/blob/v0.8.5/workflows/update-best-of-list.yml
name: update-best-of-list
on:
workflow_dispatch:
inputs:
version:
description: "Version to use for this update"
required: false
schedule:
- cron: "0 1 26 * *"
env:
BRANCH_PREFIX: "update/"
jobs:
update-best-of-list:
runs-on: ubuntu-latest
steps:
- name: Set version from input
if: ${{ github.event.inputs != null && github.event.inputs.version != null }}
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Set version via date
if: ${{ ! (env.VERSION != null && env.VERSION != '') }}
run: echo "VERSION=$(date '+%Y.%m.%d')" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Append time to version if necessary
shell: bash
run: |
git fetch --tags --force
git show-ref --tags --verify --quiet -- "refs/tags/${{ env.VERSION }}" && echo "VERSION=$(date '+%Y.%m.%d-%H.%M')" >> $GITHUB_ENV || exit 0
- name: Install best-of generator
run: pip install "best-of @ git+https://github.com/YDX-2147483647/best-of-generator.git@best-of-bits"
- name: Update best-of list
run: >-
best-of generate projects.yaml
--libraries-key=${{ secrets.LIBRARIES_KEY }}
--github-key=${{ secrets.GITHUB_TOKEN }}
--gitee-key=${{ secrets.GITEE_API_KEY }}
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
branch: ${{ env.BRANCH_PREFIX }}${{ env.VERSION }}
committer: best-of update <[email protected]>
commit-message: Update best-of list for version ${{ env.VERSION }}
title: "Best-of update: ${{ env.VERSION }}"
body: |
To finish this update: Select `Merge pull request` below and `Confirm merge`.
Also, make sure to publish the created draft release in the [releases section](../releases) as well.
- name: Publish release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: "Update: ${{ env.VERSION }}"
body_path: "latest-changes.md"
draft: true
prerelease: false