Skip to content

Commit 9932675

Browse files
committed
Merge branch 'master' into style-updates
2 parents 2384197 + b6d4ca0 commit 9932675

4 files changed

Lines changed: 112 additions & 31 deletions

File tree

.github/commit_comment_template.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/comment.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# NOTE: For screenshots to work in untrusted PRs we need to do the screenshot comment in a trusted job like this one.
2+
# See this post for details: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
3+
4+
name: Comment
5+
6+
on:
7+
workflow_run:
8+
workflows: ["Build"]
9+
types:
10+
- completed
11+
12+
jobs:
13+
comment:
14+
runs-on: ubuntu-latest
15+
if: >
16+
${{ github.event.workflow_run.conclusion == 'success' }} # && github.event.workflow_run.event == 'pull_request'
17+
18+
steps:
19+
- uses: iterative/setup-cml@v1
20+
21+
# Doesn't work for fetching artifacts from separate workflows
22+
#- name: Download screenshots
23+
# uses: actions/download-artifact@v2
24+
# with:
25+
# name: screenshots
26+
# path: screenshots
27+
28+
- name: 'Download artifact'
29+
uses: actions/github-script@v3.1.0
30+
with:
31+
script: |
32+
var artifacts = await github.actions.listWorkflowRunArtifacts({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
run_id: ${{ github.event.workflow_run.id }},
36+
});
37+
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
38+
return artifact.name == "screenshots"
39+
})[0];
40+
var download = await github.actions.downloadArtifact({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
artifact_id: matchArtifact.id,
44+
archive_format: 'zip',
45+
});
46+
var fs = require('fs');
47+
fs.writeFileSync('${{github.workspace}}/screenshots.zip', Buffer.from(download.data));
48+
49+
- run: unzip -d screenshots screenshots.zip
50+
51+
- name: Compose comment
52+
env:
53+
repo_token: ${{ secrets.GITHUB_TOKEN }}
54+
run: |
55+
echo "Here are screenshots of this commit:" >> comment.md
56+
echo "" >> comment.md # just for the newline
57+
for aw_server in screenshots/aw-*; do
58+
for aw_version in screenshots/$aw_server/*; do
59+
echo "<details><summary>Screenshots using $aw_server $aw_version (click to expand)</summary>" >> comment.md
60+
echo '<p float="left">' >> comment.md
61+
cml-publish screenshots/$aw_server/$aw_version/activity.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
62+
cml-publish screenshots/$aw_server/$aw_version/timeline.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
63+
cml-publish screenshots/$aw_server/$aw_version/settings.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
64+
cml-publish screenshots/$aw_server/$aw_version/home.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
65+
cml-publish screenshots/$aw_server/$aw_version/buckets.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
66+
cml-publish screenshots/$aw_server/$aw_version/stopwatch.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
67+
echo '</p>' >> comment.md
68+
echo -n '</details>' >> comment.md
69+
done
70+
done
71+
- name: Post screenshots in commit comment
72+
env:
73+
repo_token: ${{ secrets.GITHUB_TOKEN }}
74+
head_sha: ${{ github.event.workflow_run.head_sha }}
75+
run: |
76+
cml-send-comment --commit-sha $head_sha --repo https://github.com/ActivityWatch/aw-webui comment.md

.github/workflows/nodejs.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
41
name: Build
52

63
on:
@@ -21,7 +18,9 @@ jobs:
2118
aw-server: ["aw-server", "aw-server-rust"]
2219
aw-version: ["v0.10.0"]
2320
include:
24-
- aw-server: "aw-server-rust"
21+
- node-version: '12.x'
22+
python-version: '3.9'
23+
aw-server: "aw-server-rust"
2524
aw-version: "master"
2625

2726
steps:
@@ -36,7 +35,6 @@ jobs:
3635
uses: actions/setup-python@v1
3736
with:
3837
python-version: ${{ matrix.python-version }}
39-
- uses: iterative/setup-cml@v1
4038

4139
# TODO: Refactor out getting ActivityWatch builds (both release and nightly) into an action
4240
- name: Install and run ActivityWatch
@@ -102,26 +100,15 @@ jobs:
102100
with:
103101
name: build
104102
path: dist/*
105-
- name: Upload screenshots
106-
uses: actions/upload-artifact@v2-preview
107-
with:
108-
name: screenshots
109-
path: screenshots/*
110-
- name: Post screenshots in commit comment
103+
- name: Move screenshots to subdir
111104
env:
112-
repo_token: ${{ secrets.GITHUB_TOKEN }}
113105
aw_server: ${{ matrix.aw-server }}
114106
aw_version: ${{ matrix.aw-version }}
115107
run: |
116-
cat .github/commit_comment_template.md >> comment.md
117-
echo "<details><summary>Screenshots using $aw_server $aw_version (click to expand)</summary>" >> comment.md
118-
echo '<p float="left">' >> comment.md
119-
cml-publish screenshots/activity.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
120-
cml-publish screenshots/timeline.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
121-
cml-publish screenshots/settings.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
122-
cml-publish screenshots/home.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
123-
cml-publish screenshots/buckets.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
124-
cml-publish screenshots/stopwatch.png | sed -E 's/.+/<img width="45%" src="\0"\/>/' >> comment.md
125-
echo '</p>' >> comment.md
126-
echo -n '</details>' >> comment.md
127-
cml-send-comment comment.md
108+
mkdir -p screenshots/dist/$aw_server/$aw_version
109+
mv screenshots/*.png screenshots/dist/$aw_server/$aw_version
110+
- name: Upload screenshots
111+
uses: actions/upload-artifact@v2-preview
112+
with:
113+
name: screenshots
114+
path: screenshots/dist/*

src/util/classes.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ export const defaultCategories: Category[] = [
3232
},
3333
{
3434
name: ['Work', 'Programming'],
35-
rule: { type: 'regex', regex: 'GitHub|Stack Overflow|BitBucket|Gitlab|vim|Spyder|kate' },
35+
rule: {
36+
type: 'regex',
37+
regex: 'GitHub|Stack Overflow|BitBucket|Gitlab|vim|Spyder|kate|Ghidra|Scite',
38+
},
3639
},
3740
{
3841
name: ['Work', 'Programming', 'ActivityWatch'],
3942
rule: { type: 'regex', regex: 'ActivityWatch|aw-', ignore_case: true },
4043
},
44+
{ name: ['Work', 'Image'], rule: { type: 'regex', regex: 'Gimp|Inkscape' } },
45+
{ name: ['Work', 'Video'], rule: { type: 'regex', regex: 'Kdenlive' } },
46+
{ name: ['Work', 'Audio'], rule: { type: 'regex', regex: 'Audacity' } },
47+
{ name: ['Work', '3D'], rule: { type: 'regex', regex: 'Blender' } },
4148
{
4249
name: ['Media', 'Games'],
4350
rule: { type: 'regex', regex: 'Minecraft|RimWorld' },
@@ -46,12 +53,26 @@ export const defaultCategories: Category[] = [
4653
{ name: ['Media', 'Video'], rule: { type: 'regex', regex: 'YouTube|Plex|VLC' } },
4754
{
4855
name: ['Media', 'Social Media'],
49-
rule: { type: 'regex', regex: 'reddit|Facebook|Twitter|Instagram|devRant', ignore_case: true },
56+
rule: {
57+
type: 'regex',
58+
regex: 'reddit|Facebook|Twitter|Instagram|devRant',
59+
ignore_case: true,
60+
},
61+
},
62+
{
63+
name: ['Media', 'Music'],
64+
rule: {
65+
type: 'regex',
66+
regex: 'Spotify|Deezer',
67+
ignore_case: true,
68+
},
5069
},
51-
{ name: ['Media', 'Music'], rule: { type: 'regex', regex: 'Spotify|Deezer', ignore_case: true } },
5270
{
5371
name: ['Comms', 'IM'],
54-
rule: { type: 'regex', regex: 'Messenger|Telegram|Signal|WhatsApp|Rambox|Slack|Riot|Discord' },
72+
rule: {
73+
type: 'regex',
74+
regex: 'Messenger|Telegram|Signal|WhatsApp|Rambox|Slack|Riot|Discord|Nheko',
75+
},
5576
},
5677
{ name: ['Comms', 'Email'], rule: { type: 'regex', regex: 'Gmail|Thunderbird|mutt|alpine' } },
5778
{ name: ['Uncategorized'], rule: { type: null }, data: { color: COLOR_UNCAT } },

0 commit comments

Comments
 (0)