Skip to content

Commit

Permalink
Merge branch 'main' into discussions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherwin-14 committed Jan 4, 2025
2 parents c4c5f81 + 179f28b commit ff38db1
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions .github/workflows/discussions.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
name: Generate Discussion Thread for Hackdays

on:
push:
branches:
- discussions
- main
workflow_dispatch:

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

steps:
- name: Create a new GitHub Discussion
id: create-discussion
uses: abirismyname/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: Hackathon
body: |
Reporting out on earthaccess hack days.
Please create a new comment (at the very bottom, use the text box with a button that says "comment", not "reply") to write about what you did today!
Please include links to GitHub issues or pull requests relevant to your work, and use those issues or pull requests as the "source of truth" for documenting the work; this makes future readers jobs easier :) It's OK to duplicate some information while writing a summary here!
Use the "reply" feature to have a discussion under any given comment.
repository-id: ${{ secrets.REPO_ID }}
category-id: ${{ secrets.CAT_ID }}

- name: Print discussion url and id
- 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: \"R_kgDOL9OsOA\"
CATEGORY_ID: \"DIC_kwDOL9OsOM4ClttG\"
run: |
if [ -n "${{steps.create-discussion.outputs.discussion-id}}" ]; then
echo discussion-id: ${{steps.create-discussion.outputs.discussion-id}}
echo discussion-url: ${{steps.create-discussion.outputs.discussion-url}}
else
echo "Discussion not created"
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 ff38db1

Please sign in to comment.