forked from dotnet/dotnet-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit-learning-paths-staleness-check.yml
More file actions
76 lines (66 loc) · 2.65 KB
/
submit-learning-paths-staleness-check.yml
File metadata and controls
76 lines (66 loc) · 2.65 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: 'Submit Learning Paths Staleness Check'
on:
workflow_run:
workflows: ["Check Learning Path Links"]
types:
- completed
permissions:
contents: write
issues: write
pull-requests: write
jobs:
submit-learning-paths-staleness-check:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
id: check-user
with:
script: |
await github.rest.repos.checkCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: context.payload.workflow_run.triggering_actor.login
});
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
with:
persist-credentials: true
# Download the artifact from the workflow that kicked off this one.
# The default artifact download action doesn't support cross-workflow
# artifacts, so use a 3rd party one.
- name: 'Download linting results'
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615
with:
workflow: ${{env.workflow_name}}
run_id: ${{github.event.workflow_run.id }}
name: learning-path-review
path: ./learning-path-review
- name: Set Env Vars
run: |
modifiedFiles=$(cat ./learning-path-review/modifiedFiles)
manuallyReview=$(cat ./learning-path-review/manuallyReview)
echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV
echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV
- uses: actions/github-script@v6
name: Submit Comment
if: ${{ env.modifiedFiles != '' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODIFIED_FILES: ${{ env.modifiedFiles }}
MANUALLY_REVIEW: ${{ env.manuallyReview }}
with:
script: |
modifiedFiles = process.env.MODIFIED_FILES;
manuallyReview = process.env.MANUALLY_REVIEW;
comment_body = "### Learning Paths Links Check \n\nChanged files in the Learning Path:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n Files that should be manually reviewed:\n\n" + manuallyReview.replaceAll(",", "\n");
github.rest.issues.createComment({
issue_number: context.payload.workflow_run.pull_requests[0].number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
})