Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
satwik-miyyapuram-cohesity authored Oct 1, 2024
1 parent d5bc86c commit 198ea27
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Create Pull Request for Last Commit
name: Create Pull Request for Last Commit on Any Branch

on:
push:
branches:
- 'A' # Replace 'A' with your branch name
- '*' # Trigger on any branch

jobs:
create_pr:
Expand All @@ -13,22 +13,26 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get last commit SHA
- name: Get last commit SHA (Commit 1)
id: commit1
run: echo "::set-output name=sha1::$(git rev-parse HEAD~1)"

- name: Get current commit SHA
- name: Get current commit SHA (Commit 2)
id: commit2
run: echo "::set-output name=sha2::$(git rev-parse HEAD)"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Automated Pull Request for Commit 2"
base: ${{ github.ref_name }} # The current branch (A)
commit-message: "Automated Pull Request for new commit"
base: ${{ github.ref_name }} # The current branch name
head: ${{ steps.commit1.outputs.sha1 }} # Commit 1
compare-to: ${{ steps.commit2.outputs.sha2 }} # Commit 2
title: "CR for Commit 1 vs Commit 2"
title: "CR: Compare Commit 1 vs Commit 2"
body: |
This pull request is between Commit 1 (SHA: ${{ steps.commit1.outputs.sha1 }}) and Commit 2 (SHA: ${{ steps.commit2.outputs.sha2 }})
This pull request is automatically created to compare:
- **Commit 1 (SHA: ${{ steps.commit1.outputs.sha1 }})** and
- **Commit 2 (SHA: ${{ steps.commit2.outputs.sha2 }})**
reviewers: "" # Optionally add reviewers
labels: "auto-generated" # Optionally add labels

0 comments on commit 198ea27

Please sign in to comment.