File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Scheduled Bundle Update PR
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 0 * * 2'
6+ workflow_dispatch :
7+
8+ jobs :
9+ bundle-update :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+
16+ - name : Set up Ruby
17+ uses : ruby/setup-ruby@v1
18+ with :
19+ ruby-version : ' 3.4'
20+
21+ - name : Set up git
22+ run : |
23+ git config --global user.name "github-actions[bot]"
24+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
25+
26+ - name : Switch branch
27+ run : |
28+ git switch -c bundle-update-$(date +'%Y%m%d')-$(uuidgen | cut -c1-8)
29+
30+ - name : Install bundler
31+ run : gem install bundler
32+
33+ - name : Run bundle update
34+ run : |
35+ bundle lock --update
36+ git add Gemfile.lock
37+
38+ if git diff --cached --quiet; then
39+ echo "No changes to commit, exiting."
40+ exit 0
41+ fi
42+
43+ git commit -m "bundle update"
44+ echo "has_update=true" >> $GITHUB_ENV
45+
46+ - name : Push branch
47+ if : env.has_update == 'true'
48+ run : git push origin HEAD
49+
50+ - name : Create Pull Request
51+ if : env.has_update == 'true'
52+ env :
53+ GH_TOKEN : ${{ github.token }}
54+ run : |
55+ gh pr create \
56+ --title "bundle update `/Gemfile`" \
57+ --body "Automated bundle update" \
58+ --head "$(git rev-parse --abbrev-ref HEAD)" \
59+ --base "main"
You can’t perform that action at this time.
0 commit comments