Check Language Updates #48
This file contains hidden or 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: Check Language Updates | |
| on: | |
| schedule: | |
| - cron: '0 8 * * *' # daily at 8:00 UTC | |
| workflow_dispatch: # manual trigger from Actions tab | |
| permissions: | |
| issues: write | |
| contents: read | |
| actions: write # needed to dispatch auto-update-kap.yml | |
| jobs: | |
| check-updates: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for language updates | |
| id: check | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: bash scripts/check-language-updates.sh | |
| - name: Detect Kap-specific update | |
| id: kap | |
| if: steps.check.outcome == 'failure' | |
| run: | | |
| if [ ! -f update-report.md ]; then | |
| echo "kap_updated=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # update-report.md line format: - **Kap**: `OLD` → `NEW` — source | |
| new_version=$(grep -E '^- \*\*Kap\*\*' update-report.md \ | |
| | grep -oP '`\K[^`]+(?=`[^`]*$)' || true) | |
| if [ -n "$new_version" ]; then | |
| echo "Kap update detected: $new_version" | |
| echo "kap_version=$new_version" >> "$GITHUB_OUTPUT" | |
| echo "kap_updated=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "No Kap update in this run." | |
| echo "kap_updated=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Detect J-specific update | |
| id: j | |
| if: steps.check.outcome == 'failure' | |
| run: | | |
| if [ ! -f update-report.md ]; then | |
| echo "j_updated=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| new_version=$(grep -E '^- \*\*J\*\*' update-report.md \ | |
| | grep -oP '`\K[^`]+(?=`[^`]*$)' || true) | |
| if [ -n "$new_version" ]; then | |
| echo "J update detected: $new_version" | |
| echo "j_version=$new_version" >> "$GITHUB_OUTPUT" | |
| echo "j_updated=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "No J update in this run." | |
| echo "j_updated=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Detect Uiua-specific update | |
| id: uiua | |
| if: steps.check.outcome == 'failure' | |
| run: | | |
| if [ ! -f update-report.md ]; then | |
| echo "uiua_updated=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| new_version=$(grep -E '^- \*\*Uiua\*\*' update-report.md \ | |
| | grep -oP '`\K[^`]+(?=`[^`]*$)' || true) | |
| if [ -n "$new_version" ]; then | |
| echo "Uiua update detected: $new_version" | |
| echo "uiua_version=$new_version" >> "$GITHUB_OUTPUT" | |
| echo "uiua_updated=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "No Uiua update in this run." | |
| echo "uiua_updated=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Find or create language-update issue | |
| id: issue | |
| if: steps.check.outcome == 'failure' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| existing=$(gh issue list --label "language-update" --state open \ | |
| --json number --jq '.[0].number // empty' 2>/dev/null || echo "") | |
| if [ -n "$existing" ]; then | |
| echo "Open language-update issue already exists: #$existing" | |
| echo "issue_number=$existing" >> "$GITHUB_OUTPUT" | |
| echo "issue_created=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| gh label create "language-update" --color "0E8A16" \ | |
| --description "New language version available" 2>/dev/null || true | |
| { | |
| cat update-report.md 2>/dev/null || echo "Check workflow logs for details." | |
| echo "" | |
| echo "---" | |
| echo "*Update \`scripts/known-versions.json\` after upgrading to silence this alert.*" | |
| } > /tmp/issue-body.md | |
| issue_url=$(gh issue create \ | |
| --title "Language updates available ($(date +%Y-%m-%d))" \ | |
| --body-file /tmp/issue-body.md \ | |
| --label "language-update" \ | |
| --assignee "codereport") | |
| issue_number=$(echo "$issue_url" | grep -oE '[0-9]+$') | |
| echo "Created issue #$issue_number ($issue_url)" | |
| echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT" | |
| echo "issue_created=true" >> "$GITHUB_OUTPUT" | |
| - name: Trigger auto-update-kap workflow | |
| if: steps.kap.outputs.kap_updated == 'true' && steps.issue.outputs.issue_number != '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| KAP_VERSION: ${{ steps.kap.outputs.kap_version }} | |
| ISSUE_NUMBER: ${{ steps.issue.outputs.issue_number }} | |
| run: | | |
| echo "Dispatching auto-update-kap.yml (kap_version=$KAP_VERSION, issue=#$ISSUE_NUMBER)" | |
| gh workflow run auto-update-kap.yml \ | |
| -f kap_version="$KAP_VERSION" \ | |
| -f issue_number="$ISSUE_NUMBER" | |
| - name: Trigger auto-update-j workflow | |
| if: steps.j.outputs.j_updated == 'true' && steps.issue.outputs.issue_number != '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| J_VERSION: ${{ steps.j.outputs.j_version }} | |
| ISSUE_NUMBER: ${{ steps.issue.outputs.issue_number }} | |
| run: | | |
| echo "Dispatching auto-update-j.yml (j_version=$J_VERSION, issue=#$ISSUE_NUMBER)" | |
| gh workflow run auto-update-j.yml \ | |
| -f j_version="$J_VERSION" \ | |
| -f issue_number="$ISSUE_NUMBER" | |
| - name: Trigger auto-update-uiua workflow | |
| if: steps.uiua.outputs.uiua_updated == 'true' && steps.issue.outputs.issue_number != '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| UIUA_VERSION: ${{ steps.uiua.outputs.uiua_version }} | |
| ISSUE_NUMBER: ${{ steps.issue.outputs.issue_number }} | |
| run: | | |
| echo "Dispatching auto-update-uiua.yml (uiua_version=$UIUA_VERSION, issue=#$ISSUE_NUMBER)" | |
| gh workflow run auto-update-uiua.yml \ | |
| -f uiua_version="$UIUA_VERSION" \ | |
| -f issue_number="$ISSUE_NUMBER" |