-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (65 loc) · 2 KB
/
plot.yaml
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
name: Refresh Figures
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
outputs:
type: ${{ steps.isCIUpdated.outputs.type }}
ciUpdated: ${{ steps.isCIUpdated.outputs.ciUpdated }}
name: Refresh Figures
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Check commit message
id: isCIUpdated
run: |
commitType=$(git log -1 --pretty=%B | awk -F'-' '{print $2}' | tr -d '\n')
if [[ $(git log -1 --pretty=%B) == *"GitHub Action Update"* ]]; then
if [[ $commitType != "Map" ]]; then
echo "type=${commitType}" >> $GITHUB_OUTPUT
echo "ciUpdated=true" >> $GITHUB_OUTPUT
fi
fi
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Refresh figures
working-directory: plot
run: mkdir figures && poetry run python3 plot.py
- name: Push
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: figures
FOLDER: plot/figures
SQUASH_HISTORY: false
GITHUB_TOKEN: ${{ secrets.TOKEN }}
MESSAGE: "Figure updated"
SKIP_EMPTY_COMMITS: true
CLEAR_GLOBS_FILE: ".clear-target-files"
notify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Send Telegram notification
uses: appleboy/telegram-action@master
if: "${{ needs.build.outputs.ciUpdated == 'true' }}"
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
${{ needs.build.outputs.type }} updated
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}