From 0ea8d74e08211ae704ce6b78333e440049644389 Mon Sep 17 00:00:00 2001 From: Turusov Mihail Date: Mon, 2 Oct 2023 15:46:58 +0300 Subject: [PATCH 1/5] feat: allow overriding opening PR with a branch --- .github/workflows/build-docker-images.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker-images.yaml b/.github/workflows/build-docker-images.yaml index 86349ba..9c63505 100644 --- a/.github/workflows/build-docker-images.yaml +++ b/.github/workflows/build-docker-images.yaml @@ -28,6 +28,10 @@ on: type: boolean default: true required: false + pr_override: + type: boolean + default: false + required: false docker_additional_labels: type: string default: "" @@ -261,7 +265,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 }} @@ -273,7 +277,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v5 - 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 }} From fe9efff658831a8d99fdb596d7e19996bac2a48c Mon Sep 17 00:00:00 2001 From: Turusov Mihail Date: Mon, 2 Oct 2023 15:47:15 +0300 Subject: [PATCH 2/5] feat: add input for optional npm token --- .github/workflows/build-docker-images.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-docker-images.yaml b/.github/workflows/build-docker-images.yaml index 9c63505..ad52055 100644 --- a/.github/workflows/build-docker-images.yaml +++ b/.github/workflows/build-docker-images.yaml @@ -51,6 +51,8 @@ on: secrets: gh_token: required: true + npm_token: + required: false concurrency: group: ${{ github.event.repository.name }}-build-${{ github.event.pull_request.number }} From 56703d2acba184320f9c926b3e1a5ab54540e7b1 Mon Sep 17 00:00:00 2001 From: Turusov Mihail Date: Mon, 2 Oct 2023 15:47:38 +0300 Subject: [PATCH 3/5] chore: lint --- .github/workflows/build-docker-images.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-images.yaml b/.github/workflows/build-docker-images.yaml index ad52055..b67fde6 100644 --- a/.github/workflows/build-docker-images.yaml +++ b/.github/workflows/build-docker-images.yaml @@ -52,7 +52,7 @@ on: gh_token: required: true npm_token: - required: false + required: false concurrency: group: ${{ github.event.repository.name }}-build-${{ github.event.pull_request.number }} From 82c10e9cc575e1f2180314b61e36fc2a00d41185 Mon Sep 17 00:00:00 2001 From: Turusov Mihail Date: Tue, 3 Oct 2023 15:40:12 +0300 Subject: [PATCH 4/5] feat: add branch override for tags --- .github/workflows/build-docker-images.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker-images.yaml b/.github/workflows/build-docker-images.yaml index b67fde6..0bb0e6e 100644 --- a/.github/workflows/build-docker-images.yaml +++ b/.github/workflows/build-docker-images.yaml @@ -167,7 +167,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 }} @@ -199,7 +199,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: From 33c299885a03838d510f82ce88c0d302b704db14 Mon Sep 17 00:00:00 2001 From: Turusov Mihail Date: Thu, 5 Oct 2023 15:33:56 +0300 Subject: [PATCH 5/5] feat: overriding repo names --- .github/workflows/build-docker-images.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker-images.yaml b/.github/workflows/build-docker-images.yaml index 0bb0e6e..45be837 100644 --- a/.github/workflows/build-docker-images.yaml +++ b/.github/workflows/build-docker-images.yaml @@ -32,6 +32,9 @@ on: type: boolean default: false required: false + pr_custom_repo_name: + type: string + required: false docker_additional_labels: type: string default: "" @@ -277,6 +280,15 @@ 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@v5 if: ${{ (github.ref == 'refs/heads/master' && inputs.pr_open) || inputs.pr_override }} @@ -285,8 +297,8 @@ jobs: 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 }})