Skip to content

Merge branch 'main' of https://github.com/MedhaGupta-Ril/teswiz #29

Merge branch 'main' of https://github.com/MedhaGupta-Ril/teswiz

Merge branch 'main' of https://github.com/MedhaGupta-Ril/teswiz #29

# 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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle and run unit tests
uses: gradle/gradle-build-action@0280eb7de5ad3fb0deb50017b8ce842980b4789a
with:
arguments: 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 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. 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."
fi
env:
PAT_TOKEN: ${{ secrets.TESWIZ_PAT }}
- name: Trigger Workflow in getting-started-with-teswiz
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.TESWIZ_REPO_DISPATCH }}
repository: znsio/getting-started-with-teswiz
event-type: UpdateREADME
client-payload: '{"teswiz_commit_id":"teswiz updated" }'