Skip to content

Merge branch 'readme_workflows' into Suzu #10

Merge branch 'readme_workflows' into Suzu

Merge branch 'readme_workflows' into Suzu #10

name: Generate README
on:
push:
branches:
- 'Senko'
- 'Shiro'
- 'Suzu'
paths:
- '.github/README_templates/**'
- '.github/README_images/**'
- '.github/workflows/generate_readme.yaml'
workflow_call:
inputs:
repository-name:
required: true
type: string
branch-name:
required: true
type: string
jobs:
generate-readme:
name: Generate README
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Output env variables (push)
if: ${{ github.event_name == 'push' }}
run: |
echo 'REPOSITORY_NAME=${{ github.repository }}' >> $GITHUB_ENV
echo 'BRANCH_NAME=${{ github.ref_name }}' >> $GITHUB_ENV
- name: Output env variables (workflow_call)
if: ${{ github.event_name == 'workflow_call' }}
run: |
echo 'REPOSITORY_NAME=${{ inputs.repository-name }}' >> $GITHUB_ENV
echo 'BRANCH_NAME=${{ inputs.branch-name }}' >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4.1.1
with:
ref: ${{ env.BRANCH_NAME }}
- name: Setup Node.js@20.8.0
uses: actions/setup-node@v4.0.0
with:
node-version: 20.8.0
cache: npm
cache-dependency-path: './.github/readme_generator/package-lock.json'
- name: Install script dependencies
working-directory: ./.github/readme_generator
run: npm install
- name: Generate README
working-directory: ./.github/readme_generator
run: ./node_modules/.bin/ts-node ./readme_generator.ts ${{ env.REPOSITORY_NAME }} Gakuto1112/FiguraAvatarsReadmeTemplate main
- id: check_diff
name: Check diff
continue-on-error: true
run: |
git add -N --all
git diff --exit-code
- name: Commit and push
if: ${{ steps.check_diff.outcome == 'failure' }}
run: |
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add --all
git commit -m '[GitHub Actions] ドキュメントの自動生成' -m '対象のコミット: ${{ github.sha }}'
git push origin