Merge pull request #130 from rees46/fix/composite-action #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Commit changes composite | |
description: commit made changes | |
inputs: | |
token: | |
description: GitHub PAT | |
required: true | |
baseCommit: | |
description: Base commit to check changes from | |
required: true | |
runs: | |
using: composite | |
steps: | |
- name: GitSign | |
uses: chainguard-dev/actions/setup-gitsign@main | |
shell: bash | |
- name: Create commit message | |
id: commit_message | |
env: | |
BASE_COMMIT: ${{ inputs.baseCommit }} | |
run: | | |
INITIAL_MESSAGE=$'chore(common): versions\n\n' | |
temp_file=$(mktemp) | |
yarn workspaces foreach --since=$BASE_COMMIT exec "echo \"\$npm_package_name:\$npm_package_version \" >> $temp_file" | |
MESSAGE=$(cat $temp_file) | |
echo $(cat $temp_file) | |
INITIAL_MESSAGE+=$MESSAGE | |
INITIAL_MESSAGE="${INITIAL_MESSAGE//'%'/' '}" | |
INITIAL_MESSAGE="${INITIAL_MESSAGE//$'\n'/' '}" | |
INITIAL_MESSAGE="${INITIAL_MESSAGE//$'\r'/' '}" | |
echo "commitMessage=$INITIAL_MESSAGE" >> $GITHUB_OUTPUT | |
echo $INITIAL_MESSAGE | |
rm $temp_file | |
shell: bash | |
- name: Commit changes | |
id: committer | |
uses: EndBug/add-and-commit@v9 | |
env: | |
GITHUB_TOKEN: ${{ inputs.token }} | |
with: | |
commit: -S | |
default_author: github_actions | |
author_email: github-bot@rees46.com | |
message: ${{ steps.commit_message.outputs.commitMessage }} | |
add: '["*.lock", "*.json", "*.yml", "*.md"]' | |
shell: bash |