Add slash command and workflow to remove issue or PR from FR board (#18101)
This commit is contained in:
1
.github/allowed-actions.js
vendored
1
.github/allowed-actions.js
vendored
@@ -26,6 +26,7 @@ module.exports = [
|
||||
"juliangruber/find-pull-request-action@2fc55e82a6d5d36fe1e7f1848f7e64fd02d99de9",
|
||||
"juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512",
|
||||
"lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8",
|
||||
"octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2",
|
||||
"pascalgn/automerge-action@c9bd1823770819dc8fb8a5db2d11a3a95fbe9b07", //pascalgn/automerge@0.12.0
|
||||
"peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326",
|
||||
"peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd",
|
||||
|
||||
10
.github/commands/remove.yaml
vendored
Normal file
10
.github/commands/remove.yaml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
trigger: remove-from-fr-board
|
||||
title: Remove from FR board
|
||||
description: Remove the current issue or pull request from the project board for the docs content first responder
|
||||
surfaces:
|
||||
- issue
|
||||
- pull_request
|
||||
- discussion
|
||||
steps:
|
||||
- type: repository_dispatch
|
||||
eventType: remove_from_FR_board
|
||||
64
.github/workflows/remove-from-fr-board.yaml
vendored
Normal file
64
.github/workflows/remove-from-fr-board.yaml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Remove card from FR board
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: remove_from_FR_board
|
||||
|
||||
jobs:
|
||||
remove_from_FR_board:
|
||||
if: github.repository == 'github/docs-internal'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: find_project_cards
|
||||
uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2
|
||||
with:
|
||||
query: |
|
||||
query($issue_node_id:ID!) {
|
||||
node(id:$issue_node_id) {
|
||||
... on Issue {
|
||||
projectCards(first: 10) {
|
||||
nodes {
|
||||
id
|
||||
project {
|
||||
name
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
... on PullRequest {
|
||||
projectCards(first: 10) {
|
||||
nodes {
|
||||
id
|
||||
project {
|
||||
name
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
issue_node_id: ${{ github.event.client_payload.command.resource.id }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- run: "echo 'Project cards found: ${{ steps.find_project_cards.outputs.data }}'"
|
||||
|
||||
- name: Get FR card
|
||||
env:
|
||||
QUERY_DATA: ${{ steps.find_project_cards.outputs.data }}
|
||||
run: |
|
||||
echo 'FR_CARDS='$(jq '.node.projectCards.nodes | .[] | select(.project.id == "MDc6UHJvamVjdDQ1NzI0ODI") | .id' <<< "$QUERY_DATA") >> $GITHUB_ENV
|
||||
|
||||
- name: Delete card
|
||||
id: delete_project_card
|
||||
if: ${{ env.FR_CARDS }}
|
||||
uses: octokit/graphql-action@5b3e01d42dee4509b0ac6b1cb2cf7778cdce85c2
|
||||
with:
|
||||
query: |
|
||||
mutation DeleteCard {
|
||||
deleteProjectCard(input:{cardId:${{ env.FR_CARDS }}}) {deletedCardId}
|
||||
}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user