Skip to content

[hot fix]SSR-5043: Update user guide #445

[hot fix]SSR-5043: Update user guide

[hot fix]SSR-5043: Update user guide #445

name: Check v1 license
on:
pull_request:
branches: [master]
jobs:
license_manager:
name: Check License
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install dependencies
run: |
npm ci
npm install @actions/core @cybozu/license-manager --no-save
- name: Analyze and extract prod licenses
run: |
npx license-manager analyze -c ./license-manager/license-manager-prod.config.js
npx license-manager extract -c ./license-manager/license-manager-prod.config.js
- name: Analyze and extract dev licenses
run: |
npx license-manager analyze -c ./license-manager/license-manager-dev.config.js
npx license-manager extract -c ./license-manager/license-manager-dev.config.js
- name: Generate licenses file
id: generate_licenses
uses: ./.github/actions/generate_licenses
- name: Upload LICENSE
uses: actions/upload-artifact@v4
with:
name: LICENSE
path: ${{ steps.generate_licenses.outputs.license_file_path }}
- name: Check for modified LICENSE file
run: |
if git diff --name-only | grep -q 'LICENSE' || git ls-files --others --exclude-standard | grep -q 'LICENSE'; then
echo "LICENSE_changed=true" >> $GITHUB_ENV
else
echo "LICENSE is NOT changed"
fi
rm -f licenses-prod.json licenses-dev.json
- name: Create branch for auto update LICENSE
if: env.LICENSE_changed == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git push origin HEAD:refs/heads/bot-auto-update-LICENSE_${{ github.run_id }}-${{ github.run_attempt }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Create Pull Request
if: env.LICENSE_changed == 'true'
id: create_pr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ github.token }}
commit-message: "Update LICENSE file"
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
branch: bot-auto-update-LICENSE_${{ github.run_id }}-${{ github.run_attempt }}
base: ${{ github.head_ref }}
title: Auto Update LICENSE file
body: ''
- name: Auto merge Pull Request
if: env.LICENSE_changed == 'true' && steps.create_pr.outputs.pull-request-number
run: gh pr merge --merge --auto "${{ steps.create_pr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Delete branch for auto update LICENSE
if: env.LICENSE_changed == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git push origin --delete bot-auto-update-LICENSE_${{ github.run_id }}-${{ github.run_attempt }}