-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.23 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Create Pull Request for Last Commit on Any Branch
on:
push:
branches:
- '*' # Trigger on any branch
jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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 (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 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: Compare Commit 1 vs Commit 2"
body: |
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