Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Slack notification on missing ops #51

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .github/workflows/missing-ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- main
workflow_dispatch: {}
schedule:
# 04:00 daily
- cron: '0 4 * * *'
# 08:00 weekly on Monday
- cron: '0 8 * * 1'

env:
CARGO_TERM_COLOR: always
Expand All @@ -21,6 +21,8 @@ jobs:
missing-optypes:
name: Check for missing op type definitions
runs-on: ubuntu-latest
outputs:
should_notify: ${{ steps.check_status.outputs.result }}
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
Expand All @@ -38,4 +40,34 @@ jobs:
- name: Update the project dependencies
run: poetry -C tests update
- name: Run the missing op types test
run: poetry -C tests run -- cargo test --test integration -- --ignored missing_optypes
id: check_missing_optypes
run: poetry -C tests run -- cargo test --test integration -- --ignored missing_optypes
- name: Set output flags
id: check_status
if: always()
uses: actions/github-script@v5
with:
script: |
const outcome = ${{ steps.check_missing_optypes.outcome != 'success' }};
console.log(`The outcome is: ${outcome}`);
return outcome
result-encoding: string

notify-slack:
needs: missing-optypes
runs-on: ubuntu-latest
if: ${{ needs.missing-optypes.outputs.should_notify == 'true' && github.event_name == 'schedule' }}
steps:
- name: Compose the slack message
id: make_msg
run: |
MSG="msg=`tket-json-rs` is missing OpType definitions. See the failing check for more info.\nhttps://github.com/CQCL/tket-json-rs/actions/workflows/missing-ops.yml"
echo $MSG
echo $MSG >> "$GITHUB_OUTPUT"
- name: Send notification
uses: slackapi/[email protected]
with:
channel-id: 'C040CRWH9FF'
slack-message: ${{ steps.make_msg.outputs.msg }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Loading