Add new discussions to project #3
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: Add new organization discussions to project | |
on: | |
discussion: | |
types: [created] | |
jobs: | |
add-to-project: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Get discussion details | |
id: get_discussion | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ steps.generate_token.outputs.token }} | |
script: | | |
const query = `query($org: String!, $number: Int!) { | |
organization(login: $org) { | |
discussion(number: $number) { | |
id | |
} | |
} | |
}`; | |
const variables = { | |
org: context.payload.organization.login, | |
number: context.payload.discussion.number | |
}; | |
const result = await github.graphql(query, variables); | |
return result.organization.discussion.id; | |
- name: Add to Project | |
uses: actions/[email protected] | |
with: | |
project-url: https://github.com/orgs/stampchain-io/projects/3 | |
github-token: ${{ steps.generate_token.outputs.token }} | |
content-id: ${{ steps.get_discussion.outputs.result }} |