Skip to content

GemUpdate

GemUpdate #76

Workflow file for this run

name: GemUpdate
# https://docs.github.com/ja/actions/reference/events-that-trigger-workflows#scheduled-events
# 注意:ベースブランチの直近のコミットでのみしか実行されない
# 毎月の1日の9時にgem update のプルリクを作成する
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
jobs:
create-gem-update:
strategy:
# いずれかのmatrixジョブが失敗した場合にGitHubは進行中のジョブをすべてキャンセルします
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# ref: https://github.com/ruby/setup-ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install dependencies
run: bundle install
- name: Settings Git
run: |
git config --global user.email ${{ secrets.MAIL_ADDRESS }}
git config --global user.name "dodonki1223"
- name: Create gem update pull request
# NOTE: hub コマンドがデフォルトで入っているようなのでそのまま使用する
# https://github.com/github/hub#github-actions
run: |
git checkout -b "gem_update_`date +%Y%m%d`"
bundle update
git add .
git commit -m ':wrench: Gem Update'
git push origin "gem_update_`date +%Y%m%d`"
hub pull-request -b master -m "🔧 Gem Update `date +%Y-%m-%d`"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Github Actions notify to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
mention: 'here' # slackのメンションになる(この設定だと `@here`)
if_mention: failure
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()