-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip
deploy
workflow when PyPI token is not defined in GitHub secre…
…ts (#147) * Technical improvement * Impacted areas: CI workflows * Details: - Skip `deploy` workflow when PyPI token is not defined in GitHub secrets - Rename the GitHub secret `PYPI_TOKEN_OPENFISCA_BOT` used in `deploy` workflow to `PYPI_TOKEN` - Ensure lint scripts work properly without reachable tags - Update deprecated syntax in GitHub Action workflow
- Loading branch information
Showing
8 changed files
with
89 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#! /usr/bin/env bash | ||
|
||
# Usage: lint-files.sh <file_pattern> <linter_command> | ||
# | ||
# Example usage: | ||
# lint-files.sh "*.py" "flake8" | ||
# lint-files.sh "tests/*.yaml" "yamllint" | ||
|
||
file_pattern=$1 | ||
linter_command=$2 | ||
|
||
if [ -z "$file_pattern" ] || [ -z "$linter_command" ] | ||
then | ||
echo "Usage: $0 <file_pattern> <linter_command>" | ||
exit 1 | ||
fi | ||
|
||
last_tagged_commit=$(git describe --tags --abbrev=0 --first-parent 2>/dev/null) # Attempt to find the last tagged commit in the direct ancestry of the main branch avoiding tags introduced by merge commits from other branches | ||
|
||
if [ -z "$last_tagged_commit" ] | ||
then | ||
last_tagged_commit=$(git rev-list --max-parents=0 HEAD) # Fallback to finding the root commit if no tags are present | ||
fi | ||
|
||
if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "$file_pattern") | ||
then | ||
echo "Linting the following files:" | ||
echo "$changed_files" | ||
$linter_command $changed_files | ||
else | ||
echo "No changed files matching pattern '$file_pattern' to lint." | ||
fi |
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 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 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 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 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