Create Monthly Sync discussion #40
This file contains hidden or 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: Create Monthly Sync discussion | |
| # First Wednesday of every month at 12AM UTC | |
| on: | |
| schedule: | |
| - cron: "0 0 1-7 * 3" | |
| jobs: | |
| create-discussion: | |
| permissions: | |
| discussions: write | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Get repository information | |
| id: get-repository-info | |
| uses: octokit/graphql-action@v2.x | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| variables: | | |
| owner: ${{ github.repository_owner }} | |
| name: ${{ github.event.repository.name }} | |
| query: | | |
| query GetRepositoryInformation ($name: String!, $owner: String!) { | |
| repository(name: $name, owner: $owner) { | |
| id | |
| discussionCategory(slug: "monthly-sync") { | |
| id | |
| } | |
| } | |
| } | |
| - name: Get current date | |
| id: current-date | |
| run: echo "date=$(date +'%B %Y')" >> $GITHUB_OUTPUT | |
| - name: Create repository discussion | |
| id: create-repository-discussion | |
| uses: octokit/graphql-action@v2.x | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| variables: | | |
| body: "<b>Please add agenda items below and give your monthly update in a comment. Thank you!</b><br/><h2>Agenda</h2>" | |
| title: "Monthly Sync - ${{ steps.current-date.outputs.date }}" | |
| repositoryId: ${{ fromJSON(steps.get-repository-info.outputs.data).repository.id }} | |
| categoryId: ${{ fromJSON(steps.get-repository-info.outputs.data).repository.discussionCategory.id }} | |
| query: | | |
| mutation CreateDiscussionMutation ($title: String!, $body: String!, $repositoryId: ID!, $categoryId: ID!) { | |
| createDiscussion(input: { title: $title, body: $body, repositoryId: $repositoryId, categoryId: $categoryId }) { | |
| discussion { | |
| title | |
| } | |
| } | |
| } | |
| - name: Discussion successfully created | |
| run: echo "Created discussion '${{ fromJSON(steps.create-repository-discussion.outputs.data).createDiscussion.discussion.title }}'" |