[Cron] Send news to Matrix #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "[Cron] Send news to Matrix" | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# We'll run this daily at noon. | |
- cron: '0 12 * * *' | |
workflow_dispatch: | |
jobs: | |
runner-job: | |
if: github.repository_owner == 'galaxyproject' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# BEGIN Dependencies | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
vendor/bundle | |
~/.npm | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}-node- | |
${{ runner.os }}-gems- | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
bundle pristine ffi | |
# END Dependencies | |
- name: Send announcements to matrix | |
run: | | |
commit=$(git log --since "24 hours ago" --format=%H --first-parent main| tail -n 1) | |
bundle exec ruby bin/news.rb -p "${commit}~1" --matrix-post | |
env: | |
MATRIX_ACCESS_TOKEN: ${{ secrets.matrix_access_token }} |