-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (75 loc) · 2.7 KB
/
fetch.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
name: Fetch
on:
workflow_dispatch:
schedule:
- cron: "00 22 * * *"
jobs:
fetch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
- name: Installing
run: yarn --frozen-lockfile --perfer-offline --link-duplicates
- name: Fetch data
run: |
yarn fetch
- name: Get metadata
id: metadata
shell: bash
run: |
echo "::set-output name=data_status::$(git status -s ./data)"
echo "::set-output name=now::$(date +"%Y%m%d_%H%M")"
- name: Print metadata
run: |
echo "Data status ${{ steps.metadata.outputs.now }}"
echo "${{ steps.metadata.outputs.data_status }}"
- name: Check JSON
run: |
for filename in ./data/*\.json; do
node "$filename" > /dev/null || {
echo "Invalid JSON in $filename"
exit 1
}
done
- uses: EndBug/add-and-commit@v8
if: ${{ steps.metadata.outputs.data_status }}
env:
HUSKY: "0"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
add: "data"
author_name: ${{ secrets.SOCIALGROOVYBOT_NAME }}
author_email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
message: "feat(data): ${{ steps.metadata.outputs.now }} update"
- name: Set Registry token
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17
extra_plugins: |
@semantic-release/changelog@5.0.1
@semantic-release/exec@5.0.0
@semantic-release/git@9.0.0
env:
GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SOCIALGROOVYBOT_NPM_TOKEN }}
- name: Create the Mattermost Message
if: failure()
run: |
echo "{\"text\":\"Le fetch des fiches-vdd a échoué, veuillez relancer le job : ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
if: failure()
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}