-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.81 KB
/
pr.yml
File metadata and controls
46 lines (39 loc) · 1.81 KB
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
39
40
41
42
43
44
45
46
name: Pull Requests
on:
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
jobs:
create-pr:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch'
steps:
- name: Setup GitHub CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create a new branch from Dependabot's changes
run: |
git config --global user.name "IO"
git config --global user.email "48241519+IOxee@users.noreply.github.com"
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout -b new-branch-for-pr origin/${{ github.event.pull_request.head.ref }}
- name: Push new branch
run: git push origin new-branch-for-pr
- name: Create new PR under my name
run: |
gh pr create --title "${{ github.event.pull_request.title }}" --body "${{ github.event.pull_request.body }}" --head new-branch-for-pr --base ${{ github.event.pull_request.base.ref }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Close old Dependabot PR
if: github.event_name == 'pull_request'
run: gh pr close ${{ github.event.pull_request.number }} --delete-branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}