-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (103 loc) · 3.35 KB
/
ci.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: CI
on:
workflow_dispatch:
pull_request:
branches: [main]
types: [opened, reopened, synchronize, ready_for_review]
# cancel running actions for current PR if new commits were pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
depandabot-modify-changelog:
if: ${{ github.actor == 'dependabot[bot]' }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- run: |
insertText="### dependabot: \\\#${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}"
# check if file doesn't contain the text already
if ! grep -q "$insertText" CHANGELOG.md; then
echo "Changelog entry not found, adding it"
sed -i "/## \[Unreleased\]/a \
$insertText" CHANGELOG.md
else
echo "Changelog entry already exists, skipping"
exit 0
fi
- name: initialize mandatory git config
run: |
git config user.name "GitHub Changelog Bot"
git config user.email changelog-bot@neolution.ch
- run: npx prettier --write CHANGELOG.md
- name: commit and push
run: |
git add CHANGELOG.md
git commit -m "Add changelog entry for ${{ github.event.pull_request.title }}"
git push
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn prettier-check
- run: yarn lint
- run: yarn build
- name: Check changed files
run: |
git update-index -q --refresh
if ! git diff-index --quiet HEAD --; then
echo "Some files changed after build:"
echo
git diff --stat
echo
echo "Please rebuild it locally and commit all the files"
exit 1
fi
check-changelog:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
- name: Check if changelog was touched
run: |
changelogFound=$(echo ${{ steps.changed-files.outputs.all_changed_files }} | grep -ow "CHANGELOG.md" | wc -w)
if [ $changelogFound -eq 0 ]; then
echo '### :boom: Please update the changelog accordingly (https://keepachangelog.com)' >> $GITHUB_STEP_SUMMARY
exit 1
fi
test-action:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
#- uses: cardinalby/git-get-release-action@v1
# id: get_release
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# latest: true
- name: Use the license check action on this
uses: ./
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continueOnBlockedFound: true
blockedLicenses: |
GPL
GPL-2.0
MIT