Skip to content

Commit 37fa44d

Browse files
author
Sarah Edwards
authored
Add slash command and workflow to remove issue or PR from FR board (#18101)
1 parent 2be566c commit 37fa44d

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/allowed-actions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = [
2626
"juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9",
2727
"juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512",
2828
"lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8",
29+
"octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2",
2930
"pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07", //pascalgn/automerge@0.12.0
3031
"peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326",
3132
"peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd",

.github/commands/remove.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
trigger: remove-from-fr-board
2+
title: Remove from FR board
3+
description: Remove the current issue or pull request from the project board for the docs content first responder
4+
surfaces:
5+
- issue
6+
- pull_request
7+
- discussion
8+
steps:
9+
- type: repository_dispatch
10+
eventType: remove_from_FR_board
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Remove card from FR board
2+
3+
on:
4+
repository_dispatch:
5+
types: remove_from_FR_board
6+
7+
jobs:
8+
remove_from_FR_board:
9+
if: github.repository == 'github/docs-internal'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- id: find_project_cards
13+
uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2
14+
with:
15+
query: |
16+
query($issue_node_id:ID!) {
17+
node(id:$issue_node_id) {
18+
... on Issue {
19+
projectCards(first: 10) {
20+
nodes {
21+
id
22+
project {
23+
name
24+
id
25+
}
26+
}
27+
}
28+
}
29+
... on PullRequest {
30+
projectCards(first: 10) {
31+
nodes {
32+
id
33+
project {
34+
name
35+
id
36+
}
37+
}
38+
}
39+
}
40+
}
41+
}
42+
issue_node_id: ${{ github.event.client_payload.command.resource.id }}
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- run: "echo 'Project cards found: ${{ steps.find_project_cards.outputs.data }}'"
47+
48+
- name: Get FR card
49+
env:
50+
QUERY_DATA: ${{ steps.find_project_cards.outputs.data }}
51+
run: |
52+
echo 'FR_CARDS='$(jq '.node.projectCards.nodes | .[] | select(.project.id == "MDc6UHJvamVjdDQ1NzI0ODI") | .id' <<< "$QUERY_DATA") >> $GITHUB_ENV
53+
54+
- name: Delete card
55+
id: delete_project_card
56+
if: ${{ env.FR_CARDS }}
57+
uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2
58+
with:
59+
query: |
60+
mutation DeleteCard {
61+
deleteProjectCard(input:{cardId:${{ env.FR_CARDS }}}) {deletedCardId}
62+
}
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)