Skip to content

fix: seperate github_token #69

fix: seperate github_token

fix: seperate github_token #69

Workflow file for this run

name: Check if new version is available
on:
workflow_dispatch:
schedule:
- cron: "25 0 * * *"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
check:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Get latest anki release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "LATEST_VERSION=$(curl -s -H 'Authorization: Bearer $GITHUB_TOKEN' https://api.github.com/repos/ankitects/anki/releases/latest | jq -r '.tag_name')" >> $GITHUB_ENV

Check failure on line 22 in .github/workflows/check.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/check.yml

Invalid workflow file

You have an error in your yaml syntax on line 22
- name: Check if GHCR image tag exists
id: check
run: |
if docker manifest inspect ghcr.io/itsnicecraft/ankisyncserver:${LATEST_VERSION} > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_ENV
else
echo "exists=false" >> $GITHUB_ENV
fi
- name: Dispatch build.yml workflow if tag does not exist
if: env.exists == 'false'
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches \
-d '{"ref":"main", "inputs": {"ANKI_VERSION": "${{ env.LATEST_VERSION }}"}}'