twigrass #4395
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |