Skip to content

Commit

Permalink
add workflow for generating floor locations
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Oct 4, 2024
1 parent c359a9b commit 32747ca
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/update_floor_locations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update Floor Locations Translation map

on:
workflow_dispatch:
schedule:
- cron: '0 8 1 * *' #8AM first of the month

jobs:
update-floor-locations:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/umich_catalog_indexing/Gemfile
steps:
- uses: actions/checkout@v3
- name: Set up ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- name: Fetch Translation map
working-directory: ./umich_catalog_indexing
env:
FLOOR_LOCATION_SPREADSHEET_ID: ${{ vars.FLOOR_LOCATION_SPREADSHEET_ID }}
GOOGLE_API_CREDENTIALS: ${{ secrets.GOOGLE_API_CREDENTIALS }}
run: bundle exec ruby bin/generate_floor_locations_map.rb --force
- name: Get PR title
run: echo "PR_TITLE=$(date +'%B %Y') floor location translation map update" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "config: update floor locations translation map"
title: ${{ env.PR_TITLE }}
reviewers: niquerio
15 changes: 15 additions & 0 deletions umich_catalog_indexing/bin/generate_floor_locations_map.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/local/bin/ruby
require "optparse"
require_relative "../lib/sidekiq_jobs"

force = false
OptionParser.new do |opts|
opts.on("-f", "--force", "Force generation of floor locations translation map even if it is less than one day old") do |x|
force = true if x
end
opts.on("-h", "--help", "Prints this help") do
puts opts
exit
end
end.parse!
Jobs::TranslationMapGenerator.generate(generator: Jobs::TranslationMapGenerator::FloorLocations, force: force)

0 comments on commit 32747ca

Please sign in to comment.