Skip to content

create_pr

create_pr #21

Workflow file for this run

name: Create Pr from branch
on:
repository_dispatch:
types: [create_pr]
jobs:
build:
name: Create Branch
runs-on: ubuntu-latest
steps:
- name: Verify Event
env:
BUILD_URL: ${{ github.event.client_payload.build_url }}
PR_BRANCH: ${{ github.event.client_payload.branch }}
run: echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_ENV; echo "BUILD_URL=$BUILD_URL" >> $GITHUB_ENV
if: ${{ github.event.action == 'create_pr' && github.event.client_payload.branch && github.event.client_payload.build_url }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
if: ${{ env.PR_BRANCH && env.BUILD_URL }}
- name: Create branch and PR
run: |
set -e
git config --global user.name [email protected]
git config --global user.email [email protected]
git checkout -b ${{ env.PR_BRANCH }}
git push --set-upstream origin ${{ env.PR_BRANCH }}
composer config repositories.danskernesdigitalebibliotek/dpl-react '{"type":"package","package":{"name":"danskernesdigitalebibliotek\/dpl-react","version":"dev-master","type":"drupal-library","dist":{"url":"${{ env.BUILD_URL }}","type":"zip"},"require":{"composer\/installers":"^1.2.0"}}}'
composer remove danskernesdigitalebibliotek/dpl-react \
&& composer require danskernesdigitalebibliotek/dpl-react
git add composer.json composer.lock
git commit -m "Use new dependency url on dpl-react: ${{ env.BUILD_URL }}"
git push
gh pr create --base develop --head ${{ env.PR_BRANCH }} --title "PR for ${{ env.PR_BRANCH }}" --body "This is an automated PR for ${{ env.PR_BRANCH }}"
if: ${{ env.PR_BRANCH && env.BUILD_URL }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}