Skip to content

Commit

Permalink
Merge pull request #914 from Sherwin-14/discussions
Browse files Browse the repository at this point in the history
Add a workflow for generating Hackday Github Discussion threads
  • Loading branch information
mfisher87 authored Jan 6, 2025
2 parents 5e11bee + 0b872d5 commit 393c3ac
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/discussions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Generate Discussion Thread for Hackdays

on:
workflow_dispatch:

jobs:
create-discussion-threads:
runs-on: ubuntu-latest
permissions:
discussions: write
contents: read

steps:

- name: Generate the Hackathon title
run: |
DATE=$(date --iso-8601 | sed 's|-|/|g')
echo "DISCUSSION_TITLE=Hackathon $DATE" >> $GITHUB_ENV
- name: Set the Hackathon description
run: |
echo "DISCUSSION_BODY=Reporting out on earthaccess hack days. Use the 'comment' button at the very bottom to send a message. Additionally, consider sending issues and PRs relevant to your work to help make the job of future readers easier. It is okay to duplicate information here! Use the reply feature to have a discussion under any comment. Enjoy!" >> $GITHUB_ENV
- name: Create Discussions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_ID: MDEwOlJlcG9zaXRvcnkzOTk4Njc1Mjk=
CATEGORY_ID: DIC_kwDOF9V-ic4CdYaN!
run: |
gh api graphql -f query="
mutation
{createDiscussion
(
input:
{
repositoryId: \"${{ env.REPOSITORY_ID }}\",
categoryId: \"${{ env.CATEGORY_ID }}\",
body: \"${{ env.DISCUSSION_BODY }}\",
title: \"${{ env.DISCUSSION_TITLE }}\"
}
)
{
discussion {id}
}
}"

0 comments on commit 393c3ac

Please sign in to comment.