Skip to content

Instantly share code, notes, and snippets.

@IvanJosipovic
Created March 15, 2022 23:04
Show Gist options
  • Select an option

  • Save IvanJosipovic/440534061f356733e4616b069e189f34 to your computer and use it in GitHub Desktop.

Select an option

Save IvanJosipovic/440534061f356733e4616b069e189f34 to your computer and use it in GitHub Desktop.
branch-diff.yaml
name: Branch-Diff
on:
workflow_dispatch:
inputs:
sourceRef:
description: 'Source Ref'
required: true
default: 'origin/predev'
destinationRef:
description: 'Destination Ref'
required: true
default: 'origin/prod'
jobs:
steps:
name: Diff
runs-on: ubuntu-latest
strategy:
matrix:
branch: [main, qa, uat, prod]
steps:
- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
fetch-depth: 0
- name: Apply Diff
shell: pwsh
run: |
git diff ${{ github.event.inputs.sourceRef }} ${{ github.event.inputs.destinationRef }} | git apply
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "${{ matrix.branch }}-diff"
commit-message: "feat: Update from ${{ github.event.inputs.destinationRef }} to ${{ matrix.branch }}"
title: "feat: Update from ${{ github.event.inputs.destinationRef }} to ${{ matrix.branch }}"
body: |
Git Diff from ${{ github.event.inputs.sourceRef }}...${{ github.event.inputs.destinationRef }} to ${{ matrix.branch }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment