-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow for generating floor locations
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
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
15
umich_catalog_indexing/bin/generate_floor_locations_map.rb
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
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) |