-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (70 loc) · 2.64 KB
/
pr-metadata.yaml
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
76
77
name: "Pull Request: Get metadata"
on:
workflow_call:
outputs:
isRenovatePR:
description: "Is the PR coming from Renovate?"
value: ${{ jobs.pr-metadata.outputs.isRenovatePR }}
isFork:
description: "Is the PR coming from a forked repo?"
value: ${{ jobs.pr-metadata.outputs.isFork }}
addedOrModifiedFilesDetected:
description: "Does the PR contain any changes?"
value: ${{ jobs.pr-changes.outputs.addedOrModifiedFilesDetected }}
addedOrModifiedFiles:
description: "A list of the files changed in this PR"
value: ${{ jobs.pr-changes.outputs.addedOrModifiedFiles }}
addedOrModifiedCharts:
description: "A list of the charts changed in this PR"
value: ${{ jobs.pr-changes.outputs.addedOrModifiedCharts }}
chartsToLint:
value: ${{ jobs.pr-changes.outputs.chartsToLint }}
chartsToInstall:
value: ${{ jobs.pr-changes.outputs.chartsToInstall }}
jobs:
pr-metadata:
name: Collect PR metadata
runs-on: ubuntu-latest
outputs:
isRenovatePR: ${{ startsWith(steps.branch-name.outputs.current_branch, 'renovate/') }}
isFork: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6.1
- name: Save PR data to file
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- name: Store pr data in artifact
uses: actions/upload-artifact@v3
with:
name: pr_metadata
path: ./pr_number.txt
retention-days: 5
pr-changes:
name: Collect PR changes
runs-on: [ self-hosted, actions-runner-elfhosted.com ]
outputs:
addedOrModifiedFilesDetected: ${{ steps.changed-files.outputs.allAddedOrModified }}
addedOrModifiedFiles: ${{ steps.changed-files.outputs.allAddedOrModified_files }}
addedOrModifiedCharts: ${{ steps.changed-charts.outputs.charts }}
chartsToLint: ${{ steps.changed-charts.outputs.chartsToLint }}
chartsToInstall: ${{ steps.changed-charts.outputs.chartsToInstall }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Collect changed files
uses: dorny/paths-filter@v2
id: changed-files
with:
list-files: json
filters: |
allAddedOrModified:
- added|modified: '**'
- name: Collect changed charts
uses: bjw-s/helm-charts-actions/collect-charts@a60dc77aa47162c2b425202233165404e6923a7f
id: changed-charts