diff --git a/.github/workflow_data/discord.py b/.github/workflow_data/webhook.py similarity index 71% rename from .github/workflow_data/discord.py rename to .github/workflow_data/webhook.py index 17659f8f7..08eab46fb 100644 --- a/.github/workflow_data/discord.py +++ b/.github/workflow_data/webhook.py @@ -9,7 +9,7 @@ if __name__ == "__main__": with open(os.environ["GITHUB_EVENT_PATH"], "r") as f: event = json.load(f) - webhook = "DEV_DISCORD_WEBHOOK" + webhook = "DEV_WEBHOOK" title = desc = url = "" color = 0 fields = [] @@ -24,12 +24,13 @@ if __name__ == "__main__": else f"{count} New Commit{'' if count == 1 else 's'}" ) desc = f"[**{change}**]({event['compare']}) | [{branch}]({event['repository']['html_url']}/tree/{branch})\n" - for commit in event["commits"][:10]: - msg = commit['message'].splitlines()[0] + for i, commit in enumerate(event["commits"]): + msg = commit['message'].splitlines()[0].replace("`", "") msg = msg[:50] + ("..." if len(msg) > 50 else "") desc += f"\n[`{commit['id'][:7]}`]({commit['url']}): {msg} - [__{commit['author']['username']}__](https://github.com/{commit['author']['username']})" - if count > 10: - desc += f"\n+ {count - 10} more commits" + if len(desc) > 2020: + desc = desc.rsplit("\n", 1)[0] + f"\n+ {count - i} more commits" + break url = event["compare"] color = 16723712 if event["forced"] else 3669797 @@ -38,14 +39,14 @@ if __name__ == "__main__": url = pr["html_url"] branch = pr["base"]["ref"] + ( "" - if pr["base"]["full_name"] != pr["head"]["full_name"] + if pr["base"]["repo"]["full_name"] != pr["head"]["repo"]["full_name"] else f" <- {pr['head']['ref']}" ) name = pr["title"][:50] + ("..." if len(pr["title"]) > 50 else "") title = f"Pull Request {event['action'].title()} ({branch}): {name}" match event["action"]: case "opened": - desc = (event["body"][:2045] + "...") if len(event["body"]) > 2048 else event["body"] + desc = (pr["body"][:2045] + "...") if len(pr["body"]) > 2048 else pr["body"] color = 3669797 fields.append( @@ -80,7 +81,7 @@ if __name__ == "__main__": case "release": match event["action"]: case "published": - webhook = "DEV_DISCORD_WEBHOOK" + webhook = "RELEASE_WEBHOOK" color = 13845998 title = f"New Release published: {event['name']}" desc += f"Changelog:" @@ -123,6 +124,45 @@ if __name__ == "__main__": case _: sys.exit(1) + case "workflow_run": + run = event["workflow_run"] + url = run["html_url"] + title = "Workflow " + match run["conclusion"]: + case "action_required": + title += "Requires Attention" + color = 16751872 + case "failure": + title += "Failed" + color = 16723712 + case _: + sys.exit(0) + title += f": {run['name']}" + + case "issues": + issue = event["issue"] + url = issue["html_url"] + name = issue["title"][:50] + ("..." if len(issue["title"]) > 50 else "") + title = f"Issue {event['action'].title()}: {name}" + match event["action"]: + case "opened": + desc = (issue["body"][:2045] + "...") if len(issue["body"]) > 2048 else issue["body"] + color = 3669797 + case "closed": + color = 16723712 + case "reopened": + color = 16751872 + case _: + sys.exit(1) + + case "issue_comment": + comment = event["comment"] + issue = event["issue"] + url = comment["html_url"] + title = f"New Comment on Issue: {issue['title']}" + color = 3669797 + desc = (comment["body"][:2045] + "...") if len(comment["body"]) > 2048 else comment["body"] + case _: sys.exit(1) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 715070b83..37ec991e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: 'Build artifact' +name: 'Build' on: push: @@ -41,7 +41,7 @@ jobs: with: name: updater path: | - dist/${{ env.DEFAULT_TARGET }}-* + dist/${{ env.DEFAULT_TARGET }}-*/${{ env.DEFAULT_TARGET }}-update-*/ # - name: 'Find Previous Comment' # if: ${{ github.event.pull_request }} diff --git a/.github/workflows/hotfix.yml b/.github/workflows/hotfix.yml index 82fb6fa30..505f9c676 100644 --- a/.github/workflows/hotfix.yml +++ b/.github/workflows/hotfix.yml @@ -1,4 +1,4 @@ -name: "Hotfix integration" +name: "Hotfix" on: pull_request_review: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 818aa7d84..da9ca2a87 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: 'Lint formatting' +name: 'Lint' on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db717f6f2..61bc01fcf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: "Release integration" +name: 'Release' on: pull_request_review: @@ -69,8 +69,8 @@ jobs: draft: false prerelease: false files: | - dist/${{ env.ARTIFACT_TGZ }} - dist/${{ env.ARTIFACT_ZIP }} + ${{ env.ARTIFACT_TGZ }} + ${{ env.ARTIFACT_ZIP }} name: "${{ env.VERSION_TAG }}" tag_name: "${{ env.VERSION_TAG }}" target_commitish: ${{ github.event.pull_request.base.ref }} diff --git a/.github/workflows/sonarqube.yaml b/.github/workflows/sonarcloud.yaml similarity index 98% rename from .github/workflows/sonarqube.yaml rename to .github/workflows/sonarcloud.yaml index 7f3d311b0..e763aaad7 100644 --- a/.github/workflows/sonarqube.yaml +++ b/.github/workflows/sonarcloud.yaml @@ -1,4 +1,4 @@ -name: 'SonarCloud analysis' +name: 'SonarCloud' on: workflow_dispatch: @@ -10,7 +10,7 @@ env: DEFAULT_TARGET: f7 jobs: - analyze: + sonarcloud: runs-on: ubuntu-latest env: SONAR_SCANNER_VERSION: 4.7.0.2747 diff --git a/.github/workflows/check_submodules.yml b/.github/workflows/submodules.yml similarity index 96% rename from .github/workflows/check_submodules.yml rename to .github/workflows/submodules.yml index ad63f711b..52342fd04 100644 --- a/.github/workflows/check_submodules.yml +++ b/.github/workflows/submodules.yml @@ -1,4 +1,4 @@ -name: 'Check submodules' +name: 'Submodules' on: push: @@ -10,7 +10,7 @@ on: pull_request: jobs: - check_protobuf: + submodules: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/discord.yml b/.github/workflows/webhook.yml similarity index 57% rename from .github/workflows/discord.yml rename to .github/workflows/webhook.yml index 8ff4775ac..a4e380467 100644 --- a/.github/workflows/discord.yml +++ b/.github/workflows/webhook.yml @@ -1,4 +1,4 @@ -name: Discord webhook +name: 'Webhook' on: push: @@ -10,7 +10,14 @@ on: release: types: - "published" - check_suite: + workflow_run: + workflows: + - "Build" + - "Hotfix" + - "Lint" + - "Release" + - "SonarCloud" + - "Submodules" types: - "completed" issues: @@ -32,5 +39,5 @@ jobs: - name: Send webhook env: - DEV_DISCORD_WEBHOOK: "https://discord.com/api/webhooks/${{ secrets.DEV_WEBHOOK_ID }}/${{ secrets.DEV_WEBHOOK_TOKEN }}" - run: python .github/workflow_data/discord.py + DEV_WEBHOOK: "https://discord.com/api/webhooks/${{ secrets.DEV_WEBHOOK_ID }}/${{ secrets.DEV_WEBHOOK_TOKEN }}" + run: python .github/workflow_data/webhook.py diff --git a/ReadMe.md b/ReadMe.md index c9773fdbc..87e6df32e 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -123,7 +123,7 @@ Note: This repo is always updated with OFW & Unleashed. No need to mention all t - Custom subghz presets - Multiple NFC protocols - Multiple Sub-Ghz protocols | Merged from Unleashed, thanks @xMasterX -- Subghz and IR signal replication via gpio | Credits to @ankris812 +- Subghz and IR signal replication via gpio | Credits to @xMasterX - New API Routes for Locale settings ```