Skip to content

Add new discussions to project #3

Add new discussions to project

Add new discussions to project #3

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 }}