mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-18 20:29:44 -07:00
Update workflows (#216)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: "Hotfix integration"
|
||||
name: "Hotfix"
|
||||
|
||||
on:
|
||||
pull_request_review:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: 'Lint formatting'
|
||||
name: 'Lint'
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user