Skip to content

Update all npm dependencies - autoclosed #1815

Update all npm dependencies - autoclosed

Update all npm dependencies - autoclosed #1815

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build_And_Run_Unit_Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle and run unit tests
uses: gradle/gradle-build-action@093dfe9d598ec5a42246855d09b49dc76803c005
with:
arguments: clean build --refresh-dependencies
- name: Get Latest Commit ID and save in GITHUB_ENV
run: |
echo "COMMIT_ID=$(git rev-parse HEAD | head -c 10)" >> "$GITHUB_ENV"
- name: Update README with latest commit id and push to repo
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git status
BRANCH_NAME=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "Running on branch: '$BRANCH_NAME'"
if [[ "$BRANCH_NAME" = "main" ]]; then
git pull --rebase origin main
echo "COMMIT_ID=$COMMIT_ID"
awk -v id="$COMMIT_ID" '{gsub("commit-.*-blue", "commit-"id"-blue")}1' README.md > README_new.md
mv README_new.md README.md
if [ -n "$(git status --porcelain)" ]; then
echo "There are changes in 'main'. Update README"
git add README.md
git commit -m "Update README with latest commit ID - $COMMIT_ID"
git push -u origin main
else
echo "No local changes in 'main'. Nothing to update in the README."
fi
else
echo "Not running in 'main'. No need to update README for branch: '$BRANCH_NAME'"
fi
env:
PAT_TOKEN: ${{ secrets.TESWIZ_PAT }}
- name: Trigger Workflow in getting-started-with-teswiz
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.TESWIZ_REPO_DISPATCH }}
repository: znsio/getting-started-with-teswiz
event-type: UpdateREADME
client-payload: '{"teswiz_commit_id":"teswiz updated" }'