Dispatch announcements to Bazaar #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dispatch announcements to Bazaar | |
on: | |
discussion: | |
types: [pinned] | |
jobs: | |
DispatchAnnouncement: | |
runs-on: ubuntu-latest | |
if: | | |
github.event.discussion.category.name == 'Announcements' || | |
github.event.discussion.category.name == 'Releases' || | |
github.event.discussion.category.name == 'Research news' || | |
github.event.discussion.category.name == 'Schools and crash courses' | |
steps: | |
- name: Fetch announcement | |
id: announcement | |
env: | |
BODY: ${{ toJson(github.event.discussion.body) }} | |
run: | | |
echo "category=${{ github.event.discussion.category.name }}" >> $GITHUB_OUTPUT | |
echo "title=${{ github.event.discussion.title }}" >> $GITHUB_OUTPUT | |
echo ${BODY} > body.txt | |
echo "body=$(cat body.txt)" >> $GITHUB_OUTPUT | |
- name: Fetch current date | |
id: date | |
run: | | |
echo "date=$(date +'%Y%m')" >> $GITHUB_OUTPUT | |
echo "date_spelled=$(date +'%B %Y')" >> $GITHUB_OUTPUT | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.BAZAAR_ICUB_TECH_BOT_PAT }} | |
repository: icub-tech-iit/code | |
event-type: announcement_launched | |
client-payload: '{"description": ${{ steps.announcement.outputs.body }}, "id": "${{ steps.date.outputs.date }}", "title": "${{ steps.announcement.outputs.title }}", "date": "${{ steps.date.outputs.date_spelled }}", "image": "???", "type" : "announcement_launched", "category": "${{ steps.announcement.outputs.category }}"}' |