Update all npm dependencies #1898
This file contains 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
# 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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
repository_dispatch: | |
types: | |
- UpdateREADME # Match the custom event name from the source repository | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Update README with teswiz's latest successful commit id | |
run: | | |
echo "client_payload: ${{ toJson(github.event.client_payload) }}" | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git status | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
echo "Running on branch: '$BRANCH_NAME'" | |
if [[ "$BRANCH_NAME" = "main" ]]; then | |
git pull --rebase origin main | |
COMMIT_ID=$(curl -H "Authorization: token $PAT_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/znsio/teswiz/actions/workflows/Build_And_Run_Unit_Tests_CI.yml/runs?&status=success" \ | |
| jq -r ' [.workflow_runs[] | select (.head_branch=="main") | .head_commit.id][0][0:10] ') >> "$GITHUB_ENV" | |
echo "teswiz last successful 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 | |
git add README.md | |
git commit -m "Update README with teswiz's latest successful commit ID - $COMMIT_ID" | |
git push -u origin main | |
else | |
echo "No local changes." | |
fi | |
else | |
echo "Not running in 'main'. No need to update README for branch: '$BRANCH_NAME'" | |
fi | |
env: | |
PAT_TOKEN: ${{ secrets.TESWIZ_PAT }} | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 | |
with: | |
arguments: build --refresh-dependencies |