-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Pin django-ansible-base and add cronjob for updating django-ansible-base when new version releases #15364
Merged
Merged
Pin django-ansible-base and add cronjob for updating django-ansible-base when new version releases #15364
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ddff07c
Check and update django-ansible-base
chrismeyersfsu feffab7
Update .github/workflows/dab-release.yml
chrismeyersfsu 3b10a17
Update .github/workflows/dab-release.yml
chrismeyersfsu 45bee24
Run at 6 am every day
chrismeyersfsu 6390162
Put DAB version in the PR title
chrismeyersfsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,48 @@ | ||
--- | ||
name: django-ansible-base requirements update | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 6 * * *' # once an day @ 6 AM | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
jobs: | ||
dab-pin-newest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: dab-release | ||
name: Get current django-ansible-base release version | ||
uses: pozetroninc/github-action-get-latest-release@master | ||
with: | ||
owner: ansible | ||
repo: django-ansible-base | ||
excludes: prerelease, draft | ||
|
||
- name: Check out respository code | ||
uses: actions/checkout@v4 | ||
|
||
- id: dab-pinned | ||
name: Get current django-ansible-base pinned version | ||
run: | ||
echo "version=$(requirements/django-ansible-base-pinned-version.sh)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Update django-ansible-base pinned version to upstream release | ||
run: | ||
requirements/django-ansible-base-pinned-version.sh -s ${{ steps.dab-release.outputs.release }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
base: devel | ||
branch: bump-django-ansible-base | ||
title: Bump django-ansible-base to ${{ steps.dab-release.outputs.release }} | ||
body: | | ||
Automated .github/workflows/dab-release.yml | ||
|
||
django-ansible-base upstream released version == ${{ steps.dab-release.outputs.release }} | ||
requirements_git.txt django-ansible-base pinned version == ${{ steps.dab-pinned.outputs.version }} | ||
commit-message: | | ||
Update django-ansible-base version to ${{ steps.dab-pinned.outputs.version }} | ||
add-paths: | ||
requirements/requirements_git.txt |
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,77 @@ | ||
#!/bin/bash | ||
set +x | ||
|
||
# CONSTANTS | ||
export REGEX_LEFT='https://github.com/ansible/django-ansible-base@' | ||
export REGEX_RIGHT='#egg=django-ansible-base' | ||
|
||
# GLOBALS | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
REQ_FILE=$SCRIPT_DIR/requirements_git.txt | ||
|
||
# Pin Function | ||
DESIRED_VERSION='' | ||
Pin() | ||
{ | ||
export DESIRED_VERSION | ||
perl -p -i -e 's/\Q$ENV{REGEX_LEFT}\E(.*?)\Q$ENV{REGEX_RIGHT}\E/$ENV{REGEX_LEFT}$ENV{DESIRED_VERSION}$ENV{REGEX_RIGHT}/g' $REQ_FILE | ||
} | ||
|
||
# Current Function | ||
Current() | ||
{ | ||
REQUIREMENTS_LINE=$(grep django-ansible-base $REQ_FILE) | ||
|
||
echo "$REQUIREMENTS_LINE" | perl -nE 'say $1 if /\Q$ENV{REGEX_LEFT}\E(.*?)\Q$ENV{REGEX_RIGHT}\E/' | ||
} | ||
|
||
|
||
Help() | ||
{ | ||
# Display Help | ||
echo "" | ||
echo "Help:" | ||
echo "" | ||
echo "Interact with django-ansible-base in $REQ_FILE." | ||
echo "By default, output the current django-ansible-base pinned version." | ||
echo | ||
echo "Syntax: scriptTemplate [-s|h|v]" | ||
echo "options:" | ||
echo "s Set django-ansible-base version to pin to." | ||
echo "h Print this Help." | ||
echo "v Verbose mode." | ||
echo | ||
} | ||
|
||
if [ $# -eq 0 ]; then | ||
Current | ||
exit | ||
fi | ||
|
||
|
||
while getopts ":hs:" option; do | ||
case $option in | ||
h) # display Help | ||
Help | ||
exit | ||
;; | ||
s) | ||
DESIRED_VERSION=$OPTARG;; | ||
:) | ||
echo "Option -${OPTARG} requires an argument." | ||
Help | ||
exit 1 | ||
;; | ||
\?) # Invalid option | ||
echo "Error: Invalid option" | ||
echo "" | ||
Help | ||
exit;; | ||
esac | ||
done | ||
|
||
if [ -n "$DESIRED_VERSION" ]; then | ||
Pin | ||
Current | ||
fi | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as resolved.
Sorry, something went wrong.