Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pr from branch #51

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
30 changes: 24 additions & 6 deletions .github/workflows/build-docker-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ on:
type: boolean
default: true
required: false
pr_override:
type: boolean
default: false
required: false
pr_custom_repo_name:
type: string
required: false
docker_additional_labels:
type: string
default: ""
Expand All @@ -47,6 +54,8 @@ on:
secrets:
gh_token:
required: true
npm_token:
required: false

concurrency:
group: ${{ github.event.repository.name }}-build-${{ github.event.pull_request.number }}
Expand Down Expand Up @@ -161,7 +170,7 @@ jobs:

- name: Tag prod and latest for master branch in US
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/master'
if: $${{ (github.ref == 'refs/heads/master') || inputs.pr_override }}
timeout-minutes: 30
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Expand Down Expand Up @@ -193,7 +202,7 @@ jobs:

- name: Tag prod and latest for master branch in EU
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/master'
if: $${{ (github.ref == 'refs/heads/master') || inputs.pr_override }}
timeout-minutes: 30
continue-on-error: true
env:
Expand Down Expand Up @@ -261,7 +270,7 @@ jobs:
sha: ${{github.event.pull_request.head.sha || github.sha}}

- name: Create git commits
if: github.ref == 'refs/heads/master' && inputs.pr_open
if: ${{ (github.ref == 'refs/heads/master' && inputs.pr_open) || inputs.pr_override }}
timeout-minutes: 1
env:
IMAGE_TAG: prod-${{ needs.build.outputs.date }}-${{ needs.build.outputs.sha_short }}
Expand All @@ -271,16 +280,25 @@ jobs:
cd ${{ inputs.pr_repos }}
${{ inputs.pr_command }}

- name: Prepare PR repo name
id: pr_repo_name
run: |
if [[ -z "${{ inputs.pr_custom_repo_name }}" ]]; then
echo "::set-output name=custom_repo_name::${{ github.event.repository.name }}"
else
echo "::set-output name=custom_repo_name::${{ inputs.pr_custom_repo_name }}"
fi

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6.0.1
if: github.ref == 'refs/heads/master' && inputs.pr_open
if: ${{ (github.ref == 'refs/heads/master' && inputs.pr_open) || inputs.pr_override }}
timeout-minutes: 1
env:
IMAGE_TAG: prod-${{ needs.build.outputs.date }}-${{ needs.build.outputs.sha_short }}
AUTHOR_NAME: restream-ci-bot
with:
branch: "bump-${{ github.event.repository.name }}"
title: "bump: ${{ github.event.repository.name }}"
branch: "bump-${{ steps.pr_repo_name.outputs.custom_repo_name }}"
title: "bump: ${{ steps.pr_repo_name.outputs.custom_repo_name }}"
body: |-
author: [${{ github.event.head_commit.author.name }}](https://github.com/${{ github.event.head_commit.author.username }})
repos: [${{ github.event.repository.full_name }}](${{ github.event.repository.html_url }})
Expand Down