Skip to content

Create PR on dependent project #1

Create PR on dependent project

Create PR on dependent project #1

name: Create PR on dependent project
on:
workflow_call:
inputs:
libraryName:
description: "Name of this library (e.g., gisce/commitlint-rules)"

Check failure on line 7 in .github/workflows/create_dependent_pr.yaml

View workflow run for this annotation

GitHub Actions / Create PR on dependent project

Invalid workflow file

The workflow is not valid. .github/workflows/create_dependent_pr.yaml (Line: 7, Col: 9): Required property is missing: type .github/workflows/create_dependent_pr.yaml (Line: 11, Col: 9): Required property is missing: type
required: true
default: "gisce/commitlint-rules"
dependentProject:
description: "Name of dependent projects (e.g., gisce/ooui.js)"
required: true
default: "gisce/ooui.js"
dependentProjectBranch:
description: "Name of the branch for the dependent project (e.g., alpha)"
required: true
default: "alpha"
tagName:
description: "Name of the tag (e.g., v1.0.0-alpha.0)"
required: true
default: "v1.0.0-alpha.0"
workflow_dispatch:
jobs:
create-pr:
steps:
- name: Checkout dependent project repository
uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.dependentProject }}
ref: ${{ github.event.inputs.dependentProjectBranch }}
token: ${{ secrets.GH_PAT }}
- name: Update library version in package.json
run: |
NEW_VERSION=${{ github.event.inputs.tagName }}
NEW_VERSION=${NEW_VERSION#v} # Remove the leading 'v'
sed -i 's|"@${{ github.event.inputs.libraryName }}": "[^"]*"|"@${{ github.event.inputs.libraryName }}": "'"$NEW_VERSION"'"|' package.json
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "20.5.0"
- name: Install npm dependencies and generate package-lock.json
run: |
npm install
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GH_PAT }}
commit-message: "fix: Update ${{ github.event.inputs.libraryName }} to ${{ github.event.release.tag_name }}"
title: "Update ${{ github.event.inputs.libraryName }} to ${{ github.event.release.tag_name }}"
branch: "update-${{ github.event.inputs.libraryName }}-${{ github.event.release.tag_name }}"