|
1 | 1 | name: Update Arm Learning Path Roadmap Project Dates |
2 | 2 |
|
3 | 3 | on: |
4 | | - project_item: |
| 4 | + issues: |
5 | 5 | types: |
6 | | - - created |
7 | | - - edited |
| 6 | + - edited # Triggered when an issue is edited |
8 | 7 |
|
9 | 8 | jobs: |
10 | 9 | update-dates: |
11 | 10 | runs-on: ubuntu-latest |
12 | 11 | steps: |
13 | 12 | - name: Update Start Date |
14 | | - if: ${{ github.event.changes.fields['Status'] == 'In Progress' }} |
| 13 | + if: | |
| 14 | + contains(github.event.changes.fields['Status'].from, 'To Do') && |
| 15 | + contains(github.event.changes.fields['Status'].to, 'In Progress') |
| 16 | + env: |
| 17 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
15 | 18 | run: | |
16 | 19 | gh api graphql -f query=' |
17 | 20 | mutation($id: ID!, $date: String!) { |
18 | 21 | updateProjectV2ItemFieldValue( |
19 | 22 | input: { |
20 | | - projectId: "PVT_kwDOBVR2-M4A2QVf", |
| 23 | + projectId: "PVT_kwDOBVR2-M4A2QVf", # Replace with your actual project ID |
21 | 24 | itemId: $id, |
22 | | - fieldId: "PVTF_lADOBVR2-M4A2QVfzgrvSF4", |
| 25 | + fieldId: "PVTF_lADOBVR2-M4A2QVfzgrvSF4", # Replace with your Start Date field ID |
23 | 26 | value: $date |
24 | 27 | } |
25 | 28 | ) { |
26 | 29 | projectV2Item { |
27 | 30 | id |
28 | 31 | } |
29 | 32 | } |
30 | | - }' -f id="${{ github.event.project_item.node_id }}" -f date="$(date -u +%Y-%m-%d)" |
31 | | - |
| 33 | + }' -f id="${{ github.event.issue.node_id }}" -f date="$(date -u +%Y-%m-%d)" |
| 34 | +
|
32 | 35 | - name: Update Publish Date |
33 | | - if: ${{ github.event.changes.fields['Status'] == 'Done' }} |
| 36 | + if: | |
| 37 | + contains(github.event.changes.fields['Status'].from, 'In Progress') && |
| 38 | + contains(github.event.changes.fields['Status'].to, 'Done') |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
34 | 41 | run: | |
35 | 42 | gh api graphql -f query=' |
36 | 43 | mutation($id: ID!, $date: String!) { |
37 | 44 | updateProjectV2ItemFieldValue( |
38 | 45 | input: { |
39 | | - projectId: "PVT_kwDOBVR2-M4A2QVf", |
| 46 | + projectId: "PVT_kwDOBVR2-M4A2QVf", # Replace with your actual project ID |
40 | 47 | itemId: $id, |
41 | | - fieldId: "PVTF_lADOBVR2-M4A2QVfzgrvSMA", |
| 48 | + fieldId: "PVTF_lADOBVR2-M4A2QVfzgrvSMA", # Replace with your Publish Date (end date) field ID |
42 | 49 | value: $date |
43 | 50 | } |
44 | 51 | ) { |
45 | 52 | projectV2Item { |
46 | 53 | id |
47 | 54 | } |
48 | 55 | } |
49 | | - }' -f id="${{ github.event.project_item.node_id }}" -f date="$(date -u +%Y-%m-%d)" |
| 56 | + }' -f id="${{ github.event.issue.node_id }}" -f date="$(date -u +%Y-%m-%d)" |
0 commit comments