Skip to content

Commit 479269c

Browse files
[SDK-2032] gha: Created new action for merging dependabot PR's to new branch weekly
1 parent d365941 commit 479269c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Merge Dependabot PRs
2+
on:
3+
schedule:
4+
- cron: '0 12 * * 5' # Run this workflow every Friday at 12:00
5+
workflow_dispatch:
6+
7+
jobs:
8+
merge:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v2
13+
14+
- name: Authenticate GitHub CLI
15+
run: echo "${{ secrets.DEPENDABOT_MERGER_PAT }}" | gh auth login --with-token
16+
17+
- name: Ensure test branch is up to date with master
18+
run: |
19+
git checkout master
20+
git pull
21+
git checkout dependabot-test-branch
22+
git merge master
23+
24+
- name: Get list of PRs from dependabot
25+
id: pr_list
26+
run: |
27+
echo "::set-output name=numbers::$(gh pr list --author 'dependabot[bot]' --state open --json number --jq '.[] .number')"
28+
29+
- name: Merge PRs into test branch
30+
run: |
31+
IFS=' ' read -r -a array <<< "${{ steps.pr_list.outputs.numbers }}"
32+
for PR_NUMBER in "${array[@]}"
33+
do
34+
gh pr merge $PR_NUMBER --merge --repo ${{ github.repository }} --branch dependabot-test-branch
35+
done

0 commit comments

Comments
 (0)