-
Notifications
You must be signed in to change notification settings - Fork 234
59 lines (47 loc) · 1.51 KB
/
bundle-update.yml
File metadata and controls
59 lines (47 loc) · 1.51 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
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Scheduled Bundle Update PR
on:
schedule:
- cron: '0 0 * * 2'
workflow_dispatch:
jobs:
bundle-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- name: Set up git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Switch branch
run: |
git switch -c bundle-update-$(date +'%Y%m%d')-$(uuidgen | cut -c1-8)
- name: Install bundler
run: gem install bundler
- name: Run bundle update
run: |
bundle lock --update
git add Gemfile.lock
if git diff --cached --exit-code; then
echo "No changes to commit, exiting."
exit 0
fi
git commit -m "bundle update"
echo "has_update=true" >> $GITHUB_ENV
- name: Push branch
if: env.has_update == 'true'
run: git push origin HEAD
- name: Create Pull Request
if: env.has_update == 'true'
env:
GH_TOKEN: ${{ secrets.DEPENDABOT_MERGE_GH_TOKEN }}
run: |
gh pr create \
--title 'bundle update (`/Gemfile`)' \
--body "Automated bundle update" \
--head "$(git rev-parse --abbrev-ref HEAD)" \
--base "${{ github.event.repository.default_branch }}"