From ee5c25328076dedf3394cb1304b62fec871b7842 Mon Sep 17 00:00:00 2001 From: Shubham Hibare Date: Mon, 23 Oct 2023 12:12:09 +0530 Subject: [PATCH] chore(gh): Add PR creator GH workflow --- .github/workflows/pr-creator.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/pr-creator.yml diff --git a/.github/workflows/pr-creator.yml b/.github/workflows/pr-creator.yml new file mode 100644 index 0000000..16e8d03 --- /dev/null +++ b/.github/workflows/pr-creator.yml @@ -0,0 +1,25 @@ +name: Create PR from Dev to Default Branch +on: + workflow_dispatch: + schedule: + - cron: '30 18 * * 6' # Runs every Saturday at midnight IST (adjust as needed) + +jobs: + create-pr: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create PR + run: | + # Get the default branch name using GitHub API + DEFAULT_BRANCH=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/branches/default" | jq -r .name) + + # Create a PR from "dev" to the default branch + PR_URL=$(gh pr create --base master --head "dev" --title "Auto-generated PR" -t "Auto-generated PR" -b "Auto-generated PR") + + echo "Created PR: $PR_URL" + env: + GH_TOKEN: ${{ github.token }} \ No newline at end of file