Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA: Only execute nightly if changes made #5289

Merged
30 changes: 30 additions & 0 deletions .github/actions/check-for-changes-since-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Check for code changes after a specific tag'
description: 'Checks if there are any new commits since the specified tag'

inputs:
github_token:
description: 'GitHub token'
required: true
malmstein marked this conversation as resolved.
Show resolved Hide resolved
tag:
description: 'Tag to check'
required: true

outputs:
has_changes:
description: Whether there are new commits since the last tag
value: ${{ steps.check_for_changes.outputs.has_changes }}

runs:
using: 'composite'
steps:
- id: check_for_changes
shell: bash
run: |
# Check if there are any new commits since the tag
new_commits=$(git rev-list ${{ inputs.tag }}..HEAD --count)

if [ $new_commits -gt 0 ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
14 changes: 14 additions & 0 deletions .github/workflows/release_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
submodules: recursive
token: ${{ secrets.GT_DAXMOBILE }}
fetch-depth: 0
ref: feature/david/11-20-gha_only_execute_nightly_if_changes_made
malmstein marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up JDK 17
uses: actions/setup-java@v4
Expand All @@ -48,6 +49,19 @@ jobs:
echo "Latest tag: $output"
echo "latest_tag=$output" >> $GITHUB_OUTPUT

- name: Check for changes
id: check_for_changes
uses: ./.github/actions/check-for-changes
malmstein marked this conversation as resolved.
Show resolved Hide resolved
with:
github_token: ${{ secrets.GT_DAXMOBILE }}
tag: ${{ steps.get_latest_tag.outputs.latest_tag }}

- name: Notify if no changes
if: steps.check_for_changes.outputs.has_changes == 'false'
run: |
echo "No new commits since the last tag. Skipping release notes update."
exit 1

- name: Decode upload keys
uses: davidSchuppa/base64Secret-toFile-action@199e78f212c854d2284fada7f3cd3aba3e37d208
with:
Expand Down
Loading