fetch-new #221
Workflow file for this run
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: fetch-new | |
on: | |
workflow_dispatch: | |
inputs: | |
bvid: | |
description: 'Bilibili bvid' | |
default: '' | |
required: false | |
ytid: | |
description: 'youtube video id' | |
default: '' | |
required: false | |
url: | |
description: 'specific url to fetch' | |
default: '' | |
required: false | |
overwrite: | |
description: 'create new pr even if the same file exists' | |
default: 'false' | |
required: true | |
title: | |
description: 'rewrite title' | |
default: '' | |
required: false | |
path: | |
description: 'rewrite storage path and filename' | |
default: '' | |
required: false | |
category: | |
description: 'category' | |
default: '' | |
required: false | |
index: | |
description: 'index' | |
default: '' | |
required: false | |
# schedule: | |
# - cron: '0 22 * * *' | |
jobs: | |
fetch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: 'content' | |
- name: setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: add ts-node | |
run: npm install -g ts-node | |
- name: install dependencies | |
run: npm install | |
- name: setup env to .env | |
run: | | |
touch .env | |
echo "IMAGE_SAVE_POLICY=LOCAL" >> .env | |
cat .env | |
- name: run script | |
id: fetch | |
run: npm run gh-fetch -- --bv ${{ github.event.inputs.bvid }} --yt ${{ github.event.inputs.ytid }} ${{ github.event_name == 'workflow_dispatch' && '-o' || '' }} ${{ github.event.inputs.overwrite }} --ghac --title ${{ github.event.inputs.title }} --path ${{ github.event.inputs.path }} --category ${{ github.event.inputs.category }} --index ${{ github.event.inputs.index }} --url '${{ github.event.inputs.url }}' | |
- name: if return | |
run: | | |
echo !return ${{ steps.fetch.outputs.return=='false' }} | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.PAT }} | |
commit-message: ":memo: new ${{steps.fetch.outputs.category}} ${{ steps.fetch.outputs.title }}" | |
committer: GitHub <noreply@github.com> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
delete-branch: true | |
branch: fetch/${{ steps.fetch.outputs.branch }} | |
title: ':memo: new fetch ${{ steps.fetch.outputs.category }} ${{ steps.fetch.outputs.title }}' | |
add-paths: | | |
docs/**/*.md | |
images/**/*.webp | |
base: content | |
body: | | |
new ${{steps.fetch.outputs.category}} ${{ steps.fetch.outputs.title }} | |
${{ steps.fetch.outputs.msg }} | |
- Auto-generated by action: [create-pull-request](https://github.com/peter-evans/create-pull-request) | |
labels: | | |
${{steps.fetch.outputs.category}} | |
automated pr | |
draft: false |