Skip to content

Commit fe9ae5f

Browse files
committed
fix CI
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
1 parent 16f4e6f commit fe9ae5f

File tree

3 files changed

+56
-54
lines changed

3 files changed

+56
-54
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup Node.js
3131
uses: actions/setup-node@v4
3232
with:
33-
node-version: "22"
33+
node-version: '22'
3434
- name: Install dependencies
3535
run: npm clean-install
3636
- name: Release

.github/workflows/renovate-custom-hooks.yaml

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,67 +44,71 @@ jobs:
4444
run: |
4545
# Define the target directory
4646
TARGET_DIR="."
47-
47+
4848
# Fetch deleted files in the target directory
4949
DELETED_FILES=$(git diff --diff-filter=D --name-only HEAD -- "$TARGET_DIR")
50-
50+
5151
# Fetch added/modified files in the target directory
5252
MODIFIED_FILES=$(git diff --diff-filter=ACM --name-only HEAD -- "$TARGET_DIR")
5353
54-
# Create a temporary file for JSON output
55-
FILE_CHANGES_JSON_FILE=$(mktemp)
56-
57-
# Initialize JSON structure in the file
58-
echo '{ "deletions": [], "additions": [] }' > "$FILE_CHANGES_JSON_FILE"
54+
# Collect deletions
55+
DELETIONS_FILE=$(mktemp)
56+
echo '[]' > "$DELETIONS_FILE"
5957
60-
# Add deletions
6158
git diff --diff-filter=D --name-only HEAD -- "$TARGET_DIR" | while read -r file; do
62-
jq --arg path "$file" '.deletions += [{"path": $path}]' "$FILE_CHANGES_JSON_FILE" > "$FILE_CHANGES_JSON_FILE.tmp"
63-
mv "$FILE_CHANGES_JSON_FILE.tmp" "$FILE_CHANGES_JSON_FILE"
59+
jq --arg path "$file" '. += [{"path": $path}]' "$DELETIONS_FILE" > "$DELETIONS_FILE.tmp"
60+
mv "$DELETIONS_FILE.tmp" "$DELETIONS_FILE"
6461
done
6562
66-
# Add additions (new or modified files)
63+
# Collect additions
64+
ADDITIONS_FILE=$(mktemp)
65+
echo '[]' > "$ADDITIONS_FILE"
66+
6767
git diff --diff-filter=ACM --name-only HEAD -- "$TARGET_DIR" | while read -r file; do
6868
BASE64_CONTENT=$(base64 -w 0 <"$file")
69-
jq --arg path "$file" --arg content "$BASE64_CONTENT" \
70-
'.additions += [{"path": $path, "contents": $content}]' "$FILE_CHANGES_JSON_FILE" > "$FILE_CHANGES_JSON_FILE.tmp"
71-
mv "$FILE_CHANGES_JSON_FILE.tmp" "$FILE_CHANGES_JSON_FILE"
69+
jq --arg path "$file" --arg content "$BASE64_CONTENT" '. += [{"path": $path, "contents": $content}]' "$ADDITIONS_FILE" > "$ADDITIONS_FILE.tmp"
70+
mv "$ADDITIONS_FILE.tmp" "$ADDITIONS_FILE"
7271
done
73-
72+
7473
# Create a temporary file for the final JSON payload
7574
JSON_PAYLOAD_FILE=$(mktemp)
76-
75+
7776
# Construct the final JSON using jq and store it in a file
78-
jq -n --arg repo "$GITHUB_REPOSITORY" \
79-
--arg branch "$GITHUB_HEAD_REF" \
80-
--arg message "post upgrade changes from renovate" \
81-
--arg expectedOid "$GITHUB_SHA" \
82-
--slurpfile fileChanges "$FILE_CHANGES_JSON_FILE" \
83-
'{
84-
query: "mutation ($input: CreateCommitOnBranchInput!) {
85-
createCommitOnBranch(input: $input) {
86-
commit {
87-
url
88-
}
89-
}
90-
}",
91-
variables: {
92-
input: {
93-
branch: {
94-
repositoryNameWithOwner: $repo,
95-
branchName: $branch
96-
},
97-
message: { headline: $message },
98-
fileChanges: $fileChanges[0],
99-
expectedHeadOid: $expectedOid
100-
}
101-
}
102-
}' > "$JSON_PAYLOAD_FILE"
77+
jq -n \
78+
--slurpfile deletions "$DELETIONS_FILE" \
79+
--slurpfile additions "$ADDITIONS_FILE" \
80+
--arg repo "$GITHUB_REPOSITORY" \
81+
--arg branch "$GITHUB_HEAD_REF" \
82+
--arg message "post upgrade changes from renovate" \
83+
--arg expectedOid "$GITHUB_SHA" \
84+
'{
85+
query: "mutation ($input: CreateCommitOnBranchInput!) {
86+
createCommitOnBranch(input: $input) {
87+
commit {
88+
url
89+
}
90+
}
91+
}",
92+
variables: {
93+
input: {
94+
branch: {
95+
repositoryNameWithOwner: $repo,
96+
branchName: $branch
97+
},
98+
message: { headline: $message },
99+
fileChanges: {
100+
deletions: $deletions[0],
101+
additions: $additions[0]
102+
},
103+
expectedHeadOid: $expectedOid
104+
}
105+
}
106+
}' > "$JSON_PAYLOAD_FILE"
103107
104108
# Call GitHub API
105109
curl https://api.github.com/graphql -f \
106110
-sSf -H "Authorization: Bearer $GITHUB_TOKEN" \
107111
--data "@$JSON_PAYLOAD_FILE"
108-
112+
109113
# Clean up temporary files
110114
rm "$FILE_CHANGES_JSON_FILE" "$JSON_PAYLOAD_FILE"

release.config.mjs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,22 @@
22
* @type {import('semantic-release').GlobalConfig}
33
*/
44
export default {
5-
branches: ["main"],
5+
branches: ['main'],
66
plugins: [
77
[
8-
"@semantic-release/commit-analyzer",
8+
'@semantic-release/commit-analyzer',
99
{
10-
"preset": "angular",
11-
"releaseRules": [
12-
{ "type": "chore", "scope": "deps", "release": "patch" },
13-
]
10+
preset: 'angular',
11+
releaseRules: [{ type: 'chore', scope: 'deps', release: 'patch' }]
1412
}
1513
],
1614
[
17-
"@semantic-release/github",
15+
'@semantic-release/github',
1816
{
19-
"successComment": false,
20-
"labels": false,
21-
"addReleases": false,
17+
successComment: false,
18+
labels: false,
19+
addReleases: false
2220
}
2321
]
2422
]
25-
};
23+
}

0 commit comments

Comments
 (0)