-
-
Notifications
You must be signed in to change notification settings - Fork 137
61 lines (61 loc) · 1.94 KB
/
RenameProjectWhenMilestoneRenamed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Rename Project When Milestone Renamed
on:
milestone:
types: [edited]
jobs:
RenameProject:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
- run: npm install @actions/core
- run: npm install @actions/github
- name: Get list of projects
uses: octokit/[email protected]
id: get-project-title
with:
query: |
query getTitle( $org:String!) {
organization(login:$org) {
projectsV2(first:100) {
nodes {
id
title
number
template
closed
owner {
id
}
}
}
}
}
org: RE-SS3D
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_TOKEN }}
- name: Check for existence of milestone project
uses: ./.github/actions/check-milestone-exists
id: check-milestone-exists
with:
JSON_LIST_OF_PROJECTS: ${{ steps.get-project-title.outputs.data }}
PROJECT_NAME: ${{ github.event.changes.title.from }}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_TOKEN }}
- name: Rename Project
uses: octokit/[email protected]
id: rename-project
if: ${{ steps.check-milestone-exists.outputs.EXISTING_PROJECT_ID != ''}}
with:
query: |
mutation RenameTheProject {
updateProjectV2(input: {projectId:"${{ steps.check-milestone-exists.outputs.EXISTING_PROJECT_ID }}", title:"${{ github.event.milestone.title }}" }) {
clientMutationId
}
}
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_MANAGEMENT_TOKEN }}