Skip to content

Commit

Permalink
update spec monitoring workflow (#7)
Browse files Browse the repository at this point in the history
* add Rake task, update workflow

* add script to `bin/`

* chmod

* fix hashbang

* update trigger
  • Loading branch information
broothie committed Jul 8, 2023
1 parent 11fccf3 commit fc39602
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

tag:
needs: "test"
if: "github.ref == 'refs/heads/main'"
if: github.ref == 'refs/heads/main'
runs-on: "ubuntu-latest"
permissions:
contents: "write"
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/monitor_spec_updates.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: "Monitor spec updates"

on: workflow_dispatch
#on:
# schedule:
# - cron: "0 0 * * *" # Daily
on:
schedule:
- cron: "0 0 * * *" # Midnight-ly

jobs:
check:
Expand All @@ -15,22 +14,10 @@ jobs:
steps:
- uses: "actions/checkout@v3"

- name: "Copy valid.yml"
run: |
curl https://api.github.com/repos/jetpack-io/typeid/contents/spec/valid.yml \
-H 'Accept: application/vnd.github.raw' \
> spec/valid.yml
- name: "Copy invalid.yml"
run: |
curl https://api.github.com/repos/jetpack-io/typeid/contents/spec/invalid.yml \
-H 'Accept: application/vnd.github.raw' \
> spec/invalid.yml
- name: "Check for diff"
run: git diff
- name: "Update spec case files"
run: "bin/update_spec_case_files.sh"

- uses: "peter-evans/create-pull-request@v5"
with:
title: "Spec updates"
title: "Spec case updates"
assignees: "broothie"
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ desc "Run bundle install"
task :bundle do
sh "bundle install"
end

desc "Update spec case files"
task :update_spec_case_files do |spec|
sh "bin/update_spec_case_files.sh"
end
11 changes: 11 additions & 0 deletions bin/update_spec_case_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /usr/bin/env bash

echo "Update valid.yml"
curl https://api.github.com/repos/jetpack-io/typeid/contents/spec/valid.yml \
-H 'Accept: application/vnd.github.raw' \
> spec/valid.yml

echo "Update invalid.yml"
curl https://api.github.com/repos/jetpack-io/typeid/contents/spec/invalid.yml \
-H 'Accept: application/vnd.github.raw' \
> spec/invalid.yml

0 comments on commit fc39602

Please sign in to comment.