-
Notifications
You must be signed in to change notification settings - Fork 4
51 lines (45 loc) · 1.92 KB
/
check-for-new-tags.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
name: Check for new tags
on:
schedule:
- cron: '22 1,3,5,8,18,23 * * *'
workflow_dispatch:
jobs:
check-new-tags:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
name: Check for new releases in signalapp/Signal-Desktop
with:
script: |
const latestRelease = await github.rest.repos.getLatestRelease({
owner: 'signalapp',
repo: 'Signal-Desktop'
})
const latestTag = latestRelease.data.tag_name
core.info(`Latest tag on signalapp/Signal-Desktop is ${latestTag}`)
// Check if this tag also exists on dennisameling/Signal-Desktop already
try {
const latestReleaseDennis = await github.rest.repos.getReleaseByTag({
owner: 'dennisameling',
repo: 'Signal-Desktop',
tag: latestTag
})
core.info(`Release ${latestTag} already exists in dennisameling/Signal-Desktop. Nothing to do.`)
} catch (e) {
if (e.status && e.status === 404) {
core.info(`Release for Signal version ${latestTag} doesn't seem to exist yet on dennisameling/Signal-Desktop. Triggering a release.`)
await github.rest.actions.createWorkflowDispatch({
owner: 'dennisameling',
repo: 'signal-desktop-automation',
workflow_id: 'release.yml',
ref: 'main',
inputs: {
release: 'true',
ref_to_build: latestTag
}
})
core.info('Successfully created GitHub Actions workflow dispatch. Watch the CI run at https://github.com/dennisameling/signal-desktop-automation/actions/workflows/release.yml')
} else {
core.setFailed(`Unknown error while getting release by tag: ${e.message}`)
}
}