sourcegraph/.github/workflows/label-move.yml
James McNamara 4cc7fe3013
chore(ci): Remove dead boards (#62544)
removed dead boards
2024-05-08 14:45:39 +00:00

44 lines
1.7 KiB
YAML

name: Move labeled or milestoned issue to a specific project colum
on:
issues:
types: [ labeled ]
jobs:
# Uses Projects V2 API - see https://docs.github.com/en/issues/trying-out-the-new-projects-experience/automating-projects#example-workflow
# To get your PROJECT_ID, use:
# gh api graphql -f query='
# query($organization:
# String! $number: Int!){
# organization(login: $organization){
# projectV2(number: $number) {
# id
# }
# }
# }' -f organization="sourcegraph" -F number=<project number from board URL>
tracked-vulns-board:
runs-on: ubuntu-latest
env:
PROJECT_ID: PVT_kwDOADy5QM4ABLGv # https://github.com/orgs/sourcegraph/projects/251
GITHUB_TOKEN: ${{ secrets.GH_PROJECTS_ACTION_TOKEN }}
steps:
- name: Get issue if relevant
if: ${{ contains(github.event.issue.labels.*.name, 'vulnerability-report') }}
env:
NODE_ID: ${{ github.event.issue.node_id }}
run: echo 'NODE_ID='$NODE_ID >> $GITHUB_ENV
- name: Get pull request if relevant
if: ${{ contains(github.event.pull_request.labels.*.name, 'vulnerability-report') }}
env:
NODE_ID: ${{ github.event.pull_request.node_id }}
run: echo 'NODE_ID='$NODE_ID >> $GITHUB_ENV
- name: Add to Tracked Vulns board
if: ${{ env.NODE_ID != '' }}
run: |
gh api graphql -f query='
mutation($project:ID!, $issue:ID!) {
addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) {
item {
id
}
}
}' -f project=$PROJECT_ID -f issue=$NODE_ID