-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (51 loc) · 1.7 KB
/
twigrass.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
name: twigrass
on:
push:
workflow_dispatch:
schedule:
- cron: "0 0,6,12,18 * * *"
env:
cache-version: v2
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Check is running
uses: actions/github-script@v4
id: running_count
with:
script: |
const runed = await github.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "twigrass.yml"
});
return runed.data.workflow_runs.map(
(i) => i.status
).filter(
(i) => i === 'in_progress'
).length;
result-encoding: string
- uses: actions/checkout@v2
if: ${{ steps.running_count.outputs.result == '1' }}
- name: Get random hash
if: ${{ steps.running_count.outputs.result == '1' }}
id: hash
run: |
hash="$(sha256sum <(openssl rand -base64 10)|awk '{print $1}')"
echo "::set-output name=hash::${hash}"
- uses: actions/cache@v2
if: ${{ steps.running_count.outputs.result == '1' }}
with:
path: ./dates_cache.txt
key: ${{ runner.os }}-twigrass-${{ env.cache-version }}-${{ steps.hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-twigrass-${{ env.cache-version }}-
- name: generate
if: ${{ steps.running_count.outputs.result == '1' }}
run: ./twigrass.sh
env:
TWITTER_USER_NAME: ${{ secrets.TWITTER_USER_NAME }}
PIXELA_USER_NAME: ${{ secrets.PIXELA_USER_NAME }}
PIXELA_GRAPH_ID: ${{ secrets.PIXELA_GRAPH_ID }}
PIXELA_USER_TOKEN: ${{ secrets.PIXELA_USER_TOKEN }}