Make NodeSubject do a few minimal formatting tweaks when considerin…
#60
This file contains hidden or 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
| # Copyright 2025 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # This workflow runs on pushes to the `master` branch. It checks if | |
| # `.github/piper-cut-cl.json` has changed in the pushed commits. If changes are detected, | |
| # it indicates a new release cut has been proposed. The workflow then tags the entire | |
| # repository at that commit. | |
| name: Tag Release Version | |
| on: | |
| push: | |
| # TODO(dramaix): Trigger this workflow only when .github/piper-cut-cl.json is modified. | |
| branches: [ master ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| tag_release_version_id: | |
| name: Tag Release Version ID | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # Checkout the piper-cut-cl.json from the most recent two commits | |
| - name: Checkout Current closure-compiler Commit | |
| # https://github.com/marketplace/actions/checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 2 | |
| sparse-checkout: | | |
| .github/piper-cut-cl.json | |
| .github/ci_support/tag_release_version.sh | |
| sparse-checkout-cone-mode: false | |
| - id: detect_changes | |
| run: | | |
| PIPER_DIFF=$(git diff HEAD~1 -- .github/piper-cut-cl.json) | |
| FOUND_NEW_RELEASE=$([ -n "$PIPER_DIFF" ] && echo "true" || echo "false") | |
| echo "foundNewRelease=$FOUND_NEW_RELEASE" >> "$GITHUB_OUTPUT" | |
| echo "foundNewRelease: $FOUND_NEW_RELEASE" | |
| - id: set_piper_json_vars | |
| if: ${{ steps.detect_changes.outputs.foundNewRelease == 'true' }} | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#steps-context | |
| run: | | |
| { | |
| echo 'piperJson<<EOF' | |
| cat ./.github/piper-cut-cl.json | |
| echo EOF | |
| } >> "$GITHUB_OUTPUT" | |
| # Check out all historical commits | |
| # This is much more expensive than just checking out the most recent | |
| # 2 commits, as done above, so only do this if actually cutting a release | |
| - name: Checkout all closure-compiler commits and tags | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| if: ${{ steps.detect_changes.outputs.foundNewRelease == 'true' }} | |
| with: | |
| # a depth of 0 triggers a fetch of all historical commits/branches/tags | |
| # https://github.com/marketplace/actions/checkout#Fetch-all-history-for-all-tags-and-branches | |
| fetch-depth: 0 | |
| - name: Tag cut CL | |
| id: tag_cut_cl | |
| if: ${{ steps.detect_changes.outputs.foundNewRelease == 'true' }} | |
| run: | | |
| git config --global user.name "${GITHUB_ACTOR}" | |
| git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| .github/ci_support/tag_release_version.sh \ | |
| "${{ fromJson(env.piperJson).piper_cut_cl }}" \ | |
| "${{ fromJson(env.piperJson).version_id }}"; | |
| env: | |
| piperJson: ${{ steps.set_piper_json_vars.outputs.piperJson }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |