hato-botのCIを反映するよ! #5633
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: pr-check-npm | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- closed | |
push: | |
branches: | |
- master | |
- develop | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
pr-update-version: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
cache: npm | |
- name: Get npm version | |
id: get_npm_version | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: bash "${GITHUB_WORKSPACE}/scripts/pr_check_npm/pr_update_version/get_npm_version.sh" | |
- uses: dev-hato/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
branch-name-prefix: fix-version | |
pr-title-prefix: nodeをアップデートしてあげたよ! | |
# package.jsonに差分があれば、package.jsonからpackage-lock.jsonを作り出す | |
pr-check-npm: | |
runs-on: ubuntu-latest | |
needs: pr-update-version | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
# ここでsubmodule持ってくるとdetached headにcommitして死ぬ | |
# submodule: 'recursive' | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Node.js | |
uses: actions/[email protected] | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
with: | |
cache: npm | |
- name: Install dependencies | |
if: github.event_name != 'pull_request' || github.event.action != 'closed' | |
run: bash "${GITHUB_WORKSPACE}/scripts/pr_check_npm/npm_install.sh" | |
- uses: dev-hato/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
branch-name-prefix: npm | |
pr-title-prefix: package.jsonやpackage-lock.jsonが更新されたので直してあげたよ! | |
pr-check-npm-complete: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: pr-check-npm | |
steps: | |
- if: needs.pr-check-npm.result == 'success' | |
run: exit 0 | |
- if: needs.pr-check-npm.result != 'success' | |
run: exit 1 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true |