forked from RegsonDR/spotify-save-playlists-cron
-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (98 loc) · 3.85 KB
/
backup_nmf.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Backup New Music Friday
on:
schedule:
- cron: '00 8 * * 5'
workflow_dispatch:
jobs:
execute-cron:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Python Environment
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Requirements
run: pip install -r requirements.txt
- name: Execute Python script
run: python nmf.py
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
NEW_MUSIC_FRIDAY_ID: ${{ secrets.NEW_MUSIC_FRIDAY_ID }}
USER_ID: ${{ secrets.USER_ID }}
- name: Commit updated JSON
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add json/${{ env.jsn }}
git commit -m "${{ env.jsn }} automatic update" -a
- name: Push updated JSON
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
#- name: Tweet NMF
# id: tweet
# uses: snow-actions/[email protected]
# env:
# CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
# CONSUMER_API_SECRET_KEY: ${{ secrets.TWITTER_CONSUMER_API_SECRET_KEY }}
# ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
# ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
# with:
# status: |
# La #playlist New Music Friday Italia della settimana è ora disponibile! Inquadra il codice con l'applicazione #Spotify per ascoltarla :-) | #NewMusicFridayItalia #NewMusicFriday
# media_paths: |
# nmf_cover.png
# nmf_spoticode.png
run-if-failed:
runs-on: ubuntu-latest
needs: [execute-cron]
if: always() && (needs.execute-cron.result == 'failure')
steps:
- name: Sleep Action
uses: juliangruber/[email protected]
with:
time: 10m
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Python Environment
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Requirements
run: pip install -r requirements.txt
- name: Execute Python script
run: python nmf.py
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
NEW_MUSIC_FRIDAY_ID: ${{ secrets.NEW_MUSIC_FRIDAY_ID }}
USER_ID: ${{ secrets.USER_ID }}
- name: Commit updated JSON
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add json/${{ env.jsn }}
git commit -m "${{ env.jsn }} automatic update" -a
- name: Push updated JSON
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
#- name: Tweet NMF
# id: tweet
# uses: snow-actions/[email protected]
# env:
# CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
# CONSUMER_API_SECRET_KEY: ${{ secrets.TWITTER_CONSUMER_API_SECRET_KEY }}
# ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
# ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
# with:
# status: |
# La #playlist New Music Friday Italia della settimana è ora disponibile! Inquadra il codice con l'applicazione #Spotify per ascoltarla :-) | #NewMusicFridayItalia #NewMusicFriday
# media_paths: |
# nmf_cover.png
# nmf_spoticode.png