Skip to content

Commit

Permalink
Add url to slack messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Nov 7, 2023
1 parent b833efa commit 8c094c6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,12 @@ jobs:
python3 scripts/output_scripts/convert.py --input_file full_build_output.json --output_file out.md --key build
cat out.md >> $GITHUB_STEP_SUMMARY
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Convert to slack json
run: |
python3 scripts/output_scripts/slack.py --input_file full_build_output.json --output_file slack.json --key build --devices ${{ needs.setup-devices.outputs.names }}
python3 scripts/output_scripts/slack.py --input_file full_build_output.json --output_file slack.json --key build --devices ${{ needs.setup-devices.outputs.names }} --url ${{ env.url }}
- name: Send custom JSON data to Slack workflow
if: ${{ github.event_name == 'schedule' || inputs.send_to_slack == true }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/refresh_inputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
else
echo "Files are the same!"
fi
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Send custom JSON data to Slack workflow
if: ${{ failure() && (github.event_name == 'schedule' || inputs.send_to_slack == true) }}
id: slack
Expand All @@ -60,6 +63,7 @@ jobs:
"title": "Check input list",
"status": ":red-cross: Fail",
"status_detail": ":alert: Please update input file ! "
"url": "${{ env.url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/scan_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,12 @@ jobs:
python3 scripts/output_scripts/convert.py --input_file full_scan_output.json --output_file out.md --key scan
cat out.md >> $GITHUB_STEP_SUMMARY
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Convert to slack json
run: |
python3 scripts/output_scripts/slack.py --input_file full_scan_output.json --output_file slack.json --key scan --devices ${{ needs.setup-devices.outputs.names }}
python3 scripts/output_scripts/slack.py --input_file full_scan_output.json --output_file slack.json --key scan --devices ${{ needs.setup-devices.outputs.names }} --url ${{ env.url }}
- name: Send custom JSON data to Slack workflow
if: ${{ github.event_name == 'schedule' || inputs.send_to_slack == true }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,12 @@ jobs:
python scripts/output_scripts/convert.py --input_file test_output.json --output_file out.md --key test
cat out.md >> $GITHUB_STEP_SUMMARY
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Convert to slack json
run: |
python scripts/output_scripts/slack.py --input_file test_output.json --output_file slack.json --key test
python scripts/output_scripts/slack.py --input_file test_output.json --output_file slack.json --key test --url ${{ env.url }}
- name: Send custom JSON data to Slack workflow
if: ${{ github.event_name == 'schedule' || inputs.send_to_slack == true }}
Expand Down
3 changes: 3 additions & 0 deletions scripts/output_scripts/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def count_status(json_list, key):
parser.add_argument("--output_file", required=False, type=Path)
parser.add_argument("--key", required=False, type=str, default="build")
parser.add_argument("--devices", required=False, type=str)
parser.add_argument("--url", required=False, type=str)

args = parser.parse_args()

Expand Down Expand Up @@ -115,6 +116,8 @@ def count_status(json_list, key):
if status_detail:
slack_json["status_detail"] = status_detail

slack_json["url"] = args.url

if args.output_file:
with open(args.output_file, 'w') as f:
json.dump(slack_json, f, indent=1)
Expand Down

0 comments on commit 8c094c6

Please sign in to comment.