Skip to content

Commit

Permalink
updates to tarball handler
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Aug 4, 2024
1 parent f6f9e48 commit b136700
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maintain-tarballs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
run: npm run maintain-tarballs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: gautamkrishnar/keepalive-workflow@v1
- uses: gautamkrishnar/keepalive-workflow@v2
13 changes: 9 additions & 4 deletions tarballs/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Octokit } from '@octokit/core'
import axios from 'axios'
import fs from 'fs-extra'

const __dirname = import.meta.dirname;
const __dirname = import.meta.dirname

const execAsync = util.promisify(exec)

Expand All @@ -33,6 +33,7 @@ export class Main {
private pluginMap: Plugin[] = []

private pluginsSuccessfullyUpdated: Plugin[] = []
private pluginsNotProcessed: { plugin: Plugin, error: string }[] = []

private release: {
id: number
Expand Down Expand Up @@ -79,7 +80,6 @@ export class Main {
'homebridge',
'homebridge-broadlink-rm-pro',
'homebridge-http-switch',
'homebridge-tasmota',
'homebridge-daikin-esp8266',
'homebridge-esp8266-fan',
'@oznu/homebridge-esp8266-garage-door',
Expand Down Expand Up @@ -143,6 +143,7 @@ export class Main {
}
} catch (e) {
console.log(`ERROR: ${pluginName}`, e.message)
this.pluginsNotProcessed.push({ plugin: { name: pluginName, valid: false, version: null, packaged: false }, error: e.message })
}
}
}
Expand All @@ -167,14 +168,18 @@ export class Main {
* Update the GitHub Release
*/
async updateRelease() {
if (this.pluginsSuccessfullyUpdated.length > 0) {
if (this.pluginsSuccessfullyUpdated.length > 0 || this.pluginsNotProcessed.length > 0) {
try {
await this.octokit.request('PATCH /repos/{owner}/{repo}/releases/{release_id}', {
owner: this.githubProjectOwner,
repo: this.githubProjectRepo,
release_id: this.release.id,
name: new Date().toISOString().split('T')[0],
body: `Recently updated plugins:\n\n${this.pluginsSuccessfullyUpdated.map(x => `* ${x.name}@${x.version}`).join('\n')}`,
body: 'Recently updated plugins:\n\n'
+ `${this.pluginsSuccessfullyUpdated.map(x => `- ${x.name}@${x.version}`).join('\n')}\n`
+ '---\n'
+ 'Plugins not processed:\n\n'
+ `${this.pluginsNotProcessed.map(x => `- ${x.plugin.name} - ${x.error}`).join('\n')}`,
})
console.log('Updated release.')
} catch (e) {
Expand Down

0 comments on commit b136700

Please sign in to comment.