From 393a37c01294584df31c6c4b538d02b60d9c51bf Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 28 Nov 2022 20:04:04 +0000 Subject: Update files changed action (#19172) --- .github/workflows/format.yml | 8 +++----- .github/workflows/lint.yml | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to '.github') diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index b6ce4063fe..a93fb3a488 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -27,16 +27,14 @@ jobs: run: | pip3 install -r requirements-dev.txt - - uses: trilom/file-changes-action@v1.2.4 + - name: Get changed files id: file_changes - with: - output: ' ' - fileOutput: ' ' + uses: tj-actions/changed-files@v34 - name: Run qmk formatters shell: 'bash {0}' run: | - cat ~/files_added.txt ~/files_modified.txt > ~/files_changed.txt + echo '${{ steps.file_changes.outputs.added_files}}' '${{ steps.file_changes.outputs.modified_files}}' > ~/files_changed.txt qmk format-c --core-only $(< ~/files_changed.txt) || true qmk format-python $(< ~/files_changed.txt) || true qmk format-text $(< ~/files_changed.txt) || true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5b8a45f26b..af656cf80f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,21 +19,20 @@ jobs: - name: Install dependencies run: pip3 install -r requirements-dev.txt - - uses: trilom/file-changes-action@v1.2.4 + - name: Get changed files id: file_changes - with: - output: '\n' + uses: tj-actions/changed-files@v34 - name: Print info run: | git rev-parse --short HEAD echo ${{ github.event.pull_request.base.sha }} - echo '${{ steps.file_changes.outputs.files}}' + echo '${{ steps.file_changes.outputs.all_changed_files}}' - name: Run qmk lint shell: 'bash {0}' run: | - QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.files}}') + QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.all_changed_files}}' | sed 's/ /\n/g') QMK_KEYBOARDS=$(qmk list-keyboards) exit_code=0 -- cgit v1.2.3 From 5a3594366f2bd8a4aed34f6d085d9c516b9dbc32 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 1 Jan 2023 00:46:17 +0000 Subject: Initial DD keycode regen workflow (#19400) --- .github/workflows/regen.yml | 33 ++++++++++++++++++++++++++++++ .github/workflows/regen_push.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/regen.yml create mode 100644 .github/workflows/regen_push.yml (limited to '.github') diff --git a/.github/workflows/regen.yml b/.github/workflows/regen.yml new file mode 100644 index 0000000000..ae25bc095e --- /dev/null +++ b/.github/workflows/regen.yml @@ -0,0 +1,33 @@ +name: PR Regenerate Files + +permissions: + contents: read + +on: + pull_request: + paths: + - 'data/constants/**' + - 'lib/python/**' + +jobs: + regen: + runs-on: ubuntu-latest + + container: qmkfm/qmk_cli + + steps: + - uses: actions/checkout@v3 + + - name: Run qmk generators + run: | + util/regen.sh + git diff + + - name: Fail when regeneration required + run: | + git diff + for file in $(git diff --name-only); do + echo "File '${file}' Requires Regeneration" + echo "::error file=${file}::Requires Regeneration" + done + test -z "$(git diff --name-only)" diff --git a/.github/workflows/regen_push.yml b/.github/workflows/regen_push.yml new file mode 100644 index 0000000000..fb3314f319 --- /dev/null +++ b/.github/workflows/regen_push.yml @@ -0,0 +1,43 @@ +name: Regenerate Files + +permissions: + contents: write + +on: + push: + branches: + - master + - develop + +jobs: + regen: + runs-on: ubuntu-latest + + container: qmkfm/qmk_cli + + steps: + - uses: actions/checkout@v3 + + - name: Run qmk generators + run: | + util/regen.sh + git diff + + - uses: rlespinasse/github-slug-action@v3.x + + - name: Become QMK Bot + run: | + git config user.name 'QMK Bot' + git config user.email 'hello@qmk.fm' + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + if: ${{ github.repository == 'qmk/qmk_firmware'}} + with: + token: ${{ secrets.QMK_BOT_TOKEN }} + delete-branch: true + branch: bugfix/format_${{ env.GITHUB_REF_SLUG }} + author: QMK Bot + committer: QMK Bot + commit-message: Regenerate Files + title: '[CI] Regenerate Files' -- cgit v1.2.3 From cd1f05a23aee74baa722020c4930f274ff46ea37 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 1 Jan 2023 02:38:31 +0000 Subject: Use unique name for regen PR branches (#19464) --- .github/workflows/regen_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/regen_push.yml b/.github/workflows/regen_push.yml index fb3314f319..37b26d980c 100644 --- a/.github/workflows/regen_push.yml +++ b/.github/workflows/regen_push.yml @@ -36,7 +36,7 @@ jobs: with: token: ${{ secrets.QMK_BOT_TOKEN }} delete-branch: true - branch: bugfix/format_${{ env.GITHUB_REF_SLUG }} + branch: bugfix/regen_${{ env.GITHUB_REF_SLUG }} author: QMK Bot committer: QMK Bot commit-message: Regenerate Files -- cgit v1.2.3 From 603c86b6a21dbcf3c2804ae70776ab042ee185ca Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 22 Jan 2023 03:15:10 +0000 Subject: Run format-text on keyboard PRs (#19656) --- .github/workflows/lint.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to '.github') diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2bae44ae99..67d4093a0b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,6 +39,7 @@ jobs: QMK_KEYBOARDS=$(qmk list-keyboards) exit_code=0 + for KB in $QMK_KEYBOARDS; do KEYBOARD_CHANGES=$(echo "$QMK_CHANGES" | grep -E '^(keyboards/'${KB}'/)') if [[ -z "$KEYBOARD_CHANGES" ]]; then @@ -54,6 +55,16 @@ jobs: exit_code=$(($exit_code + $?)) fi done + + qmk format-text ${{ steps.file_changes.outputs.all_changed_files}} || true + for file in ${{ steps.file_changes.outputs.all_changed_files}}; do + if ! git diff --quiet $file; then + echo "File '${file}' Requires Formatting" + echo "::error file=${file}::Requires Formatting" + exit_code=$(($exit_code + 1)) + fi + done + if [[ $exit_code -gt 255 ]]; then exit 255 fi -- cgit v1.2.3