Skip to content

Commit

Permalink
ci: add cron job to sync up with Volar (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework authored Jul 5, 2024
1 parent 52423b2 commit 75c40ef
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/sync-volar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Create issue when sync up Volar is required

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
check_file_changes:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: 'volarjs/volar.js'
fetch-depth: 0

- name: Check if runTsc.ts changed in last 24 hours
id: check_changes
run: |
CHANGED=$(git log --name-only --since="24 hours ago" --pretty=format: | sort | uniq | grep -q "packages/typescript/lib/quickstart/runTsc.ts" && echo "true" || echo "false")
echo "file_changed=${CHANGED}" >> $GITHUB_OUTPUT
- name: Create issue if runTsc.ts changed
if: steps.check_changes.outputs.file_changed == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const date = new Date();
const options = { year: 'numeric', month: '2-digit', day: '2-digit' };
const formattedDate = date.toLocaleDateString('en-CA', options);
const issueTitle = `Volar Change Detected in Last 24 Hours (${formattedDate})`;
# write new line for each line in issueBody
const issueBody = "## ✨ Sync up needed\n\nThe file [`packages/typescript/lib/quickstart/runTsc.ts`](https://github.com/volarjs/volar.js/blob/master/packages/typescript/lib/quickstart/runTsc.ts) in Volar has changed in the last 24 hours.\n\nFile [`packages/vite-plugin-checker/src/checkers/vueTsc/prepareVueTsc.ts`](https://github.com/fi3ework/vite-plugin-checker/blob/main/packages/vite-plugin-checker/src/checkers/vueTsc/prepareVueTsc.ts) contains some code copied from there, please help to sync up the modification from Volar.\n\nRemember to close this issue when is sync up is finished.";
await github.rest.issues.create({
owner,
repo,
title: issueTitle,
body: issueBody,
labels: ['vue-tsc']
});

0 comments on commit 75c40ef

Please sign in to comment.