Skip to content

Alice: Async Comms #604

Alice: Async Comms

Alice: Async Comms #604

name: "Alice: Async Comms"
# References
# - https://gist.github.com/pdxjohnny/9f3dc18f0a42d3107aaa2363331d8faa#file-intel_dffml_alice_async_comms-json-L8
# - https://github.com/marketplace/actions/github-graphql-api-query
# - https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions#adddiscussioncomment
# - https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-creating
# - https://github.com/Textualize/rich/blob/84e628655a2981ee90413ca3f35001ec3954161d/.github/workflows/readmechanged.yml#L1-L24 (MIT)
on:
workflow_dispatch: null
schedule:
- cron: '0 6 * * *'
jobs:
posts:
name: Create Async Comms Posts in Relevant Locations
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: '3.12'
cache: 'pip'
- name: Dump engineering log entries
id: dump-logs
env:
GH_TOKEN: ${{ github.token }}
TITLE: "docs: discussions: Alice Engineering Comms"
DISCUSSION_NUMBER: 1406
run: |
set -xeuo pipefail
python -m pip install -U pip setuptools wheel
python -m pip install aiohttp
python -u scripts/dump_discussion.py --token "$GH_TOKEN" --owner $(echo $GITHUB_REPOSITORY | sed -e 's/\/.*//g') --repo $(echo $GITHUB_REPOSITORY | sed -e 's/.*\///g') --discussion-number $DISCUSSION_NUMBER | tee /dev/stderr | sed -e 's/\/tree\/alice/\/tree\/main/g' -e 's/\/blob\/alice/\/blob\/main/g' | python -u scripts/discussion_dump_to_markdown.py
echo "msg=$TITLE: $(date -Iseconds)" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e
with:
commit-message: ${{ steps.dump-logs.outputs.msg }}
title: ${{ steps.dump-logs.outputs.msg }}
branch: chore-docs-alice-comms
delete-branch: true
author: 'Alice OA <aliceoa@intel.com>'
add-paths: docs
- name: Post engineering log entry
env:
GITHUB_TOKEN: ${{ github.token }}
TITLE: "Engineering Logs"
DISCUSSIONID: 'D_kwDOCOlgGM4AQHvL'
run: |
set -x
BODY="# $(date +%4Y-%m-%d) ${TITLE}"
# Source: https://github.com/Textualize/rich/blob/84e628655a2981ee90413ca3f35001ec3954161d/.github/workflows/readmechanged.yml (MIT)
gh api graphql -H 'GraphQL-Features: discussions_api' -f body="$BODY" -F discussionId="$DISCUSSIONID" -f query='mutation($body: String!, $discussionId: ID!){addDiscussionComment(input:{body: $body , discussionId: $discussionId}){comment{id}}}'