run #3611
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: run | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "15 2,8,14,20 * * *" | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
ARTIFACT_URL=$(gh api -q '.artifacts[0].archive_download_url' /repos/${{ github.repository }}/actions/artifacts) | |
[ ! -z "${ARTIFACT_URL}" ] && curl -sLo artifact.zip -H "Authorization: token ${GH_TOKEN}" ${ARTIFACT_URL} | |
[ -f artifact.zip ] && file artifact.zip && unzip artifact.zip && rm artifact.zip | |
- name: Install prerequsites | |
run: pip3 install -r requirements.txt | |
- name: Checkout watch repository | |
# Work-around secrets not accessible in conditionals as per https://github.com/actions/runner/issues/520 | |
env: | |
SOURCEMON_WATCH_REPO: ${{ secrets.SOURCEMON_WATCH_REPO }} | |
if: ${{ env.SOURCEMON_WATCH_REPO != null }} | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ secrets.SOURCEMON_WATCH_REPO }} | |
ssh-key: ${{ secrets.SOURCEMON_WATCH_REPO_KEY || '' }} | |
token: ${{ secrets.SOURCEMON_WATCH_REPO_TOKEN || github.token }} | |
path: watches | |
- name: Checkout watch data repository | |
# Work-around secrets not accessible in conditionals as per https://github.com/actions/runner/issues/520 | |
env: | |
SOURCEMON_WATCHDATA_REPO: ${{ secrets.SOURCEMON_WATCHDATA_REPO }} | |
if: ${{ env.SOURCEMON_WATCHDATA_REPO != null }} | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ secrets.SOURCEMON_WATCHDATA_REPO }} | |
ssh-key: ${{ secrets.SOURCEMON_WATCHDATA_REPO_KEY || '' }} | |
token: ${{ secrets.SOURCEMON_WATCHDATA_REPO_TOKEN || github.token }} | |
path: watch-data | |
- name: Execute watch | |
run: python3 ./watch.py --cache ./cache.tar.gz ./watches/ | |
- name: Commit watch data repository | |
# Work-around secrets not accessible in conditionals as per https://github.com/actions/runner/issues/520 | |
env: | |
SOURCEMON_WATCHDATA_REPO: ${{ secrets.SOURCEMON_WATCHDATA_REPO }} | |
if: ${{ env.SOURCEMON_WATCHDATA_REPO != null }} | |
run: | | |
pushd watch-data | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git add -A | |
git commit --allow-empty -m "Watch $(date +%s)" | |
git push | |
popd | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cache.tar.gz | |
path: ./cache.tar.gz | |
retention-days: 7 |