feat(logging)_: enable runtime logs configuration #1944
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: "Conventional Commits" | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- labeled | |
- unlabeled | |
jobs: | |
lint_pr_commits: | |
name: Validate commit messages | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Check commit message | |
id: check_commit_message | |
if: always() | |
run: | | |
set +e | |
base_sha=${{ github.event.pull_request.base.sha }} | |
head_sha=${{ github.event.pull_request.head.sha }} | |
output=$(./_assets/scripts/commit_check.sh "${base_sha}" "${head_sha}" 2>&1) | |
exit_code=$? | |
echo "${output}" | sed '$d' | |
echo "has_breaking_changes=${has_breaking_changes}" | |
echo "exit_code=${exit_code}" >> $GITHUB_OUTPUT | |
has_breaking_changes=$(echo "${output}" | tail -n 1) | |
echo "has_breaking_changes=${has_breaking_changes}" >> $GITHUB_OUTPUT | |
invalid_commit_messages=$(echo "${output}" | sed '1d;$d') | |
invalid_commit_messages=$(echo "${output}" | sed '1d;$d') | |
invalid_commit_messages=$(echo "${invalid_commit_messages}" | sed 's/\x1b\[[0-9;]*m//g') # Remove color codes | |
invalid_commit_messages=$(echo "${invalid_commit_messages}" | sed 's/^Commit message is ill-formed: //') # Remove prefix | |
if [[ $exit_code -ne 0 ]]; then | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "error_message<<$EOF" >> "$GITHUB_ENV" | |
echo "${invalid_commit_messages}" >> "$GITHUB_ENV" | |
echo "$EOF" >> "$GITHUB_ENV" | |
fi | |
- name: "Publish failed commit messages" | |
uses: marocchino/sticky-pull-request-comment@v2 | |
# When the previous steps fails, the workflow would stop. By adding this | |
# condition you can continue the execution with the populated error message. | |
if: always() && (steps.check_commit_message.outputs.exit_code != 0) | |
with: | |
header: commit-message-lint-error | |
message: | | |
We require commits to follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), but with `_` for non-breaking changes. | |
Please fix these commit messages: | |
``` | |
${{ env.error_message }} | |
``` | |
- name: "Publish breaking changes message" | |
uses: marocchino/sticky-pull-request-comment@v2 | |
# When the previous steps fails, the workflow would stop. By adding this | |
# condition you can continue the execution with the populated error message. | |
if: always() && (steps.check_commit_message.outputs.exit_code == 0 && steps.check_commit_message.outputs.has_breaking_changes == 'true') | |
with: | |
header: commit-message-lint-error | |
message: | | |
Looks like you have BREAKING CHANGES in your PR. | |
Please make sure to follow [💔How to introduce breaking changes](https://www.notion.so/How-to-introduce-breaking-changes-ded9ec2d91464a46a2593c0d8de62fbe?pvs=4) guide: | |
### Check-list | |
- [ ] Tried to avoid this breaking change | |
- [ ] Updated [status-desktop](https://github.com/status-im/status-desktop) | |
- [ ] Updated [status-mobile](https://github.com/status-im/status-mobile) | |
# Delete a previous comment when the issue has been resolved | |
- name: "Delete previous comment" | |
if: ${{ steps.check_commit_message.outputs.exit_code == 0 && steps.check_commit_message.outputs.has_breaking_changes == 'false' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: commit-message-lint-error | |
delete: true | |
- name: "Mark as failed" | |
if: steps.check_commit_message.outputs.exit_code != 0 | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.setFailed("Some commit messages are ill-formed") | |
- name: "Update breaking changes label" | |
if: always() | |
run: | | |
if [[ $ADD_LABEL == 'true' ]]; then | |
command="--add-label" | |
else | |
command="--remove-label" | |
fi | |
gh issue edit "$NUMBER" $command "breaking change" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
NUMBER: ${{ github.event.pull_request.number }} | |
ADD_LABEL: ${{ steps.check_commit_message.outputs.has_breaking_changes == 'true' }} |