-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (127 loc) · 5.28 KB
/
UpdateChecker.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
on:
push:
schedule:
- cron: '47 9,15,18 * * 1-5'
env:
Project: NET/UpdateChecker/UpdateChecker.csproj
IssueTemplate: UpdateCheckResultIssue.md
name: UpdateChecker Issue creators
permissions:
contents: write
issues: write
pull-requests: write
jobs:
updatechecker:
runs-on: ubuntu-latest
env:
actionpath: ${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Setup env
id: setupurl
run: |
url=$(curl -s https://api.github.com/repos/${{ env.actionpath }}/jobs | jq -j .jobs[0].html_url)
echo "actionjoburl=$url" >> "$GITHUB_OUTPUT"
echo "$url" >> "$GITHUB_STEP_SUMMARY"
echo "date=$(date -u "+%Y-%m-%d")" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
uses: actions/cache@v4
with:
path: NET/UpdateChecker/bin
key: build-${{ hashFiles('NET/**') }}
- name: Cache doc data
id: cache-doc
uses: actions/cache@v4
with:
path: .doc_cache
key: doc_cache-${{ steps.setupurl.outputs.date }}-${{ github.run_id }}
restore-keys: |
doc_cache-${{ steps.setupurl.outputs.date }}
doc_cache-
- name: .NET Setup
if: steps.cache-build.outputs.cache-hit != 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- run: dotnet restore ${{ env.Project }}
if: steps.cache-build.outputs.cache-hit != 'true'
- run: dotnet build $Project --configuration Release --no-restore
if: steps.cache-build.outputs.cache-hit != 'true'
- name: Pre List .doc_cache
run: ls -lha .doc_cache || ls -lha
- name: Run Update Checker ${{ github.server_url }}/${{ env.actionpath }}
id: update-checker
run: |
./NET/UpdateChecker/bin/Release/net6.0/UpdateChecker || (ls -lh; find .; exit 1)
[ -f "$IssueTemplate" ] && cat $IssueTemplate && echo newdata=true >> "$GITHUB_OUTPUT" || echo No $IssueTemplate found
bash Data/Tools/update-readme-with-konto.sh
git add README.md
- name: Set up Python
if: steps.update-checker.outputs.newdata == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install Python Pip dependencies
if: steps.update-checker.outputs.newdata == 'true'
run: python -m pip install --upgrade pip setuptools wheel
- name: Install Python Pdf dependencies
if: steps.update-checker.outputs.newdata == 'true'
run: python -m pip install -r Data/Tools/requirements.txt
- name: Install OS camelot dependencies
if: steps.update-checker.outputs.newdata == 'true'
run: sudo apt install -y ghostscript python3-tk libgl1
- name: Run ParsePdfs.py
if: steps.update-checker.outputs.newdata == 'true'
run: python Data/Tools/ParsePdfs.py
- name: Stage Data to git
if: steps.update-checker.outputs.newdata == 'true'
run: git add Data
- name: Check for changes
id: data-changes
run: git diff --staged --quiet || echo "staged=true" >> "$GITHUB_OUTPUT"
- name: Update IssueTemplate with Data diff
if: steps.data-changes.outputs.staged == 'true'
run: |
echo "\`\`\`diff" >> $IssueTemplate
git diff --staged >> $IssueTemplate
echo "\`\`\`" >> $IssueTemplate
cat $IssueTemplate
cat $IssueTemplate >> "$GITHUB_STEP_SUMMARY"
- name: Create UpdateCheckerDiscovery branch
if: steps.data-changes.outputs.staged == 'true'
run: |
git checkout -b UpdateCheckerDiscovery
git config user.email ""
git config user.name "Action UpdateChecker"
git commit -m "DATA UpdateChecker Changes from ParsePdfs"
- name: Push UpdateCheckerDiscovery branch
if: steps.data-changes.outputs.staged == 'true'
run: git push origin HEAD:refs/heads/UpdateCheckerDiscovery -f
- name: doc artifacts
uses: actions/upload-artifact@v4
with:
name: docs-from-cache
path: .doc_cache
- name: Post List .doc_cache
run: ls -lha .doc_cache || ls -lha
- name: Create Issue from ${{ env.IssueTemplate }}
if: steps.update-checker.outputs.newdata == 'true'
id: create-issue
uses: JasonEtco/create-an-issue@v2
env:
actionurl: ${{ steps.setupurl.outputs.actionjoburl }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: ${{ env.IssueTemplate }}
update_existing: false
- name: Issue created info
if: steps.create-issue.outputs.number != ''
run: echo Created issue ${{ steps.create-issue.outputs.number }} at ${{ steps.create-issue.outputs.url }}; exit 1
- name: Pull request UpdateCheckerDiscovery
if: steps.data-changes.outputs.staged == 'true'
id: create-pr
run: echo pr=$(gh pr create -B main -H UpdateCheckerDiscovery --title 'UpdateChecker Data changes' --body 'Created by Github action ${{ steps.create-issue.outputs.url }} From ${{ steps.setupurl.outputs.actionjoburl }}') >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}