From ec9e9139bfb03f655248ecec5f14fcddc00b9de7 Mon Sep 17 00:00:00 2001 From: Enoch R Lindeman Date: Thu, 12 Sep 2024 20:03:34 -0700 Subject: [PATCH] Update and rename add-license-header.yml to add-source-header.yml (#45) --- ...cense-header.yml => add-source-header.yml} | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) rename .github/workflows/{add-license-header.yml => add-source-header.yml} (65%) diff --git a/.github/workflows/add-license-header.yml b/.github/workflows/add-source-header.yml similarity index 65% rename from .github/workflows/add-license-header.yml rename to .github/workflows/add-source-header.yml index 324870b86..99013f569 100644 --- a/.github/workflows/add-license-header.yml +++ b/.github/workflows/add-source-header.yml @@ -1,4 +1,4 @@ -name: Add License Header +name: Add Source Header on: push: @@ -10,7 +10,7 @@ on: workflow_dispatch: # Allows manual triggering of the workflow jobs: - add-license-header: + add-source-header: runs-on: ubuntu-latest permissions: contents: write @@ -36,25 +36,25 @@ jobs: with: python-version: 3.x - - name: Append License Header to Files + - name: Append Source Header to Files run: | - # Define the license header template and comment prefix - LICENSE_HEADER=$(cat license-header.txt) + # Define the source header template and comment prefix + SOURCE_HEADER=$(cat source-header.txt) COMMENT_PREFIX="// " - # Remove trailing whitespace from the license header - LICENSE_HEADER=$(echo "$LICENSE_HEADER" | sed 's/[ \t]*$//g') + # Remove trailing whitespace from the source header + SOURCE_HEADER=$(echo "$SOURCE_HEADER" | sed 's/[ \t]*$//g') - # Comment out the license header - LICENSE_HEADER_COMMENTED=$(echo "$LICENSE_HEADER" | sed "s|^|$COMMENT_PREFIX|") + # Comment out the source header + SOURCE_HEADER_COMMENTED=$(echo "$SOURCE_HEADER" | sed "s|^|$COMMENT_PREFIX|") # Loop through all Rust source files for FILE in $(find . -name '*.rs'); do # Remove existing header (assume it's the first commented block) sed -i '/^\/\/ /d' "$FILE" - # Prepend the new license header - echo "$LICENSE_HEADER_COMMENTED" | cat - "$FILE" > temp && mv temp "$FILE" + # Prepend the new source header + echo "$SOURCE_HEADER_COMMENTED" | cat - "$FILE" > temp && mv temp "$FILE" done - name: Check if any files were modified @@ -66,14 +66,14 @@ jobs: echo "changes=false" >> $GITHUB_OUTPUT fi - - name: Create Pull Request with License Header Updates + - name: Create Pull Request with Source Header Updates if: steps.changes.outputs.changes == 'true' uses: peter-evans/create-pull-request@v4 with: token: ${{ steps.generate_token.outputs.token }} - commit-message: "Update license header in source files" - branch: license-header-updates - title: "Update License Headers" + commit-message: "Update source header in source files" + branch: source-header-updates + title: "Update Source Headers" body: | - This pull request updates the license headers in the source files. + This pull request updates the source headers in the source files. labels: automated