Skip to content

Commit

Permalink
add notification action
Browse files Browse the repository at this point in the history
  • Loading branch information
f-peverali committed Oct 7, 2024
1 parent cb20c8e commit afadc3a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/TooLUpdateNotification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Update Dependency

on: # Trigger on commits to any branch and manual trigger
workflow_dispatch: # Allows manual trigger
push:
branches:
- '**' # Trigger on commits to any branch

permissions:
contents: write
pull-requests: write

jobs:
update-dependency:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up jq
run: sudo apt-get install jq

- name: Fetch latest version of dependency
id: fetch_version
run: |
# Fetch the latest version from the FirelyTeam/firely-terminal-pipeline GitHub repository
LATEST_VERSION=$(curl -s https://api.github.com/repos/FirelyTeam/firely-terminal-pipeline/releases/latest | jq -r .tag_name)
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
- name: Check difference with main.yml
run: |
# Check if the main.yml file needs to be updated
CURRENT_VERSION=$(grep -oP '(?<=uses: FirelyTeam/firely-terminal-pipeline@).*$' .github/workflows/main.yml)
# if they differ, print the current version in the main.yml file and rompare it with current version in repository.
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "Current version in main.yml: $CURRENT_VERSION"
echo "Latest version in repository: $LATEST_VERSION"
else
echo "Current version in main.yml is up-to-date"
exit 1
fi
8 changes: 3 additions & 5 deletions .github/workflows/ToolUpdate.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Update Dependency

on:
push:
branches:
- '**' # Trigger on commits to any branch
on: # Trigger only manually within github page
workflow_dispatch: # Allows manual trigger

permissions:
contents: write
Expand Down Expand Up @@ -34,7 +32,7 @@ jobs:
- name: Commit changes
env:
WORKFLOW_PERMISSION_GITHUB: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }}
WORKFLOW_PERMISSION_GITHUB: ${{ secrets.WORKFLOW_PERMISSION_GITHUB }} # Personal access token with workflow permissions
run: |
# Commit the changes
git config --global user.name 'github-actions[bot]'
Expand Down

0 comments on commit afadc3a

Please sign in to comment.