-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.84 KB
/
new-funcs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Detect new functions
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
detect-missing-funcs:
name: Check for new template functions
runs-on: ubuntu-latest
permissions:
issues: write
env:
GH_TOKEN: ${{ github.token }}
LYTFS_GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
- run: go install github.com/jo3-l/yagfuncdata/cmd/lytfs@latest
- name: Generate diff against lytfs and create issue if needed
run: |
new_func_diff=$(python3 cmd/lytfs-diff.py)
existing_issue=$(gh issue list --label new-funcs --state open --json number -q '.[0].number')
if [ -n "$new_func_diff" ]; then
issue_body=$(
cat << EOF
## ⚠️ Bundled function definitions are outdated
The following functions need to be added:
\`\`\`diff
$new_func_diff
\`\`\`
This check is run automatically every day at 00:00 UTC. Go to the [Actions tab][new-funcs-workflow] to manually trigger an update.
[new-funcs-workflow]: https://github.com/jo3-l/yag-template-lsp/actions/workflows/new-funcs.yml
_Last updated at: $(date -u +"%Y-%m-%d %H:%M:%S UTC")_
EOF
)
if [ -n "$existing_issue" ]; then
gh issue edit "$existing_issue" --body "$issue_body"
else
gh issue create --title "Bundled function definitions are outdated" --body "$issue_body" --label new-funcs --assignee jo3-l
fi
else
echo "no new functions"
if [ -n "$existing_issue" ]; then
gh issue close "$existing_issue" --comment "All new functions have been added." --reason completed
fi
fi