Skip to content

Commit 2decc10

Browse files
committed
fix: composite action
1 parent a660bdd commit 2decc10

File tree

3 files changed

+52
-10
lines changed

3 files changed

+52
-10
lines changed

.github/workflows/composite-base-commit-js.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ name: Version composite action
22
description: patch versions of changed packages
33

44
inputs:
5-
private:
6-
description: Should apply only to private?
7-
required: false
8-
default: 'false'
9-
checkChanges:
10-
description: Should run 'yarn --since'?
11-
required: false
12-
default: 'true'
135
token:
146
description: GitHub PAT
157
required: true
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Commit changes composite
2+
description: commit made changes
3+
4+
inputs:
5+
token:
6+
description: GitHub PAT
7+
required: true
8+
baseCommit:
9+
description: Base commit to check changes from
10+
required: true
11+
12+
runs:
13+
using: composite
14+
15+
steps:
16+
- name: GitSign
17+
uses: chainguard-dev/actions/setup-gitsign@main
18+
shell: bash
19+
20+
- name: Create commit message
21+
id: commit_message
22+
env:
23+
BASE_COMMIT: ${{ inputs.baseCommit }}
24+
run: |
25+
INITIAL_MESSAGE=$'chore(common): versions\n\n'
26+
temp_file=$(mktemp)
27+
yarn workspaces foreach --since=$BASE_COMMIT exec "echo \"\$npm_package_name:\$npm_package_version \" >> $temp_file"
28+
MESSAGE=$(cat $temp_file)
29+
echo $(cat $temp_file)
30+
INITIAL_MESSAGE+=$MESSAGE
31+
INITIAL_MESSAGE="${INITIAL_MESSAGE//'%'/' '}"
32+
INITIAL_MESSAGE="${INITIAL_MESSAGE//$'\n'/' '}"
33+
INITIAL_MESSAGE="${INITIAL_MESSAGE//$'\r'/' '}"
34+
echo "commitMessage=$INITIAL_MESSAGE" >> $GITHUB_OUTPUT
35+
echo $INITIAL_MESSAGE
36+
rm $temp_file
37+
shell: bash
38+
39+
- name: Commit changes
40+
id: committer
41+
uses: EndBug/add-and-commit@v9
42+
env:
43+
GITHUB_TOKEN: ${{ inputs.token }}
44+
with:
45+
commit: -S
46+
default_author: github_actions
47+
author_email: [email protected]
48+
message: ${{ steps.commit_message.outputs.commitMessage }}
49+
add: '["*.lock", "*.json", "*.yml", "*.md"]'
50+
shell: bash

.github/workflows/composite-release-js.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ runs:
2121
if: inputs.isMonorepo == 'true'
2222
env:
2323
BASE_COMMIT: ${{ inputs.baseCommit }}
24-
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
24+
GH_TOKEN: ${{ inputs.token }}
2525
run: yarn workspaces foreach --since=$BASE_COMMIT^ exec 'bash -c "yarn pack && VERSION=$npm_package_version && NAME=$npm_package_name && gh release create \"\$NAME-v\$VERSION\" ./package.tgz --title=\$NAME-\$VERSION --notes-file=./CHANGELOG.md"'
2626
shell: bash
2727

2828
- name: Release single package
2929
if: inputs.isMonorepo == 'false'
3030
env:
3131
BASE_COMMIT: ${{ inputs.baseCommit }}
32-
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
32+
GH_TOKEN: ${{ inputs.token }}
3333
run: yarn workspaces foreach --since=$BASE_COMMIT^ exec 'bash -c "yarn pack && VERSION=$npm_package_version && gh release create \"v\$VERSION\" ./package.tgz --title=\$VERSION --notes-file=./CHANGELOG.md"'
3434
shell: bash

0 commit comments

Comments
 (0)