forked from slurpcode/slurp
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (46 loc) · 1.39 KB
/
weekly_run.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Weekly Ruby Script Runner
on:
# for testing purposes
push:
branches:
- main
schedule:
- cron: '0 0 * * 0' # Runs every weekend
jobs:
run-scripts:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.4
- name: Install mechanize gem
run: |
gem install mechanize;
- name: Run new.rb script
id: run-new-rb-script
run: |
ruby seek/new.rb;
exit_code=$?;
echo "new.rb exit code: $exit_code";
echo "exit_code=$exit_code" >> $GITHUB_ENV;
if [ $exit_code -eq 0 ]; then
echo "new.rb succeeded.";
else
echo "new.rb failed with exit code $exit_code.";
exit $exit_code; # Exit with the last exit code
fi;
- name: Commit and push changes if any
if: env.exit_code == '0'
run: |
git config --global user.name "github-actions[bot]";
git config --global user.email "github-actions[bot]@users.noreply.github.com";
git add seek/job_ind.json;
if git diff-index --quiet HEAD; then
echo "No changes to commit.";
else
git commit -m "Update seek/job_ind.json";
git push origin main;
fi;