Skip to content

Commit

Permalink
Refresh for 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Sep 11, 2024
1 parent c3039c2 commit f8e2844
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/run-since-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,32 @@ permissions:
pull-requests: write

jobs:
run_script:
since_updater:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'jenkinsci' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run update-since-todo.py
run: |
body=$(./update-since-todo.py)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "PROGRESS=$body" >> $GITHUB_OUTPUT
{
echo 'PROGRESS<<EOF'
echo "${body}"
echo 'EOF'
} >> $GITHUB_OUTPUT
id: run_script
shell: bash
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20 # v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Fill in since annotations
title: Fill in since annotations
body: ${{ steps.run_script.outputs.PROGRESS }}
base: master
labels: skip-changelog
branch: actions/update-since-todo
delete-branch: true
9 changes: 5 additions & 4 deletions update-since-todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def update_file(file, lineno, old, new):
:param old: The old substring.
:param new: The new substring.
"""
print("\tUpdating file in place")
print("* Updating file in place")
with fileinput.FileInput(file, inplace=True) as f:
for line in f:
if f.lineno() == lineno and old in line:
Expand All @@ -44,13 +44,13 @@ def analyze_file(file, lineno, commits_and_tags, dry_run=False):
.split("\n", 1)[0]
.split(" ", 1)[0]
)
print(f"\tfirst sha: {line_sha}")
print(f"* first sha: {line_sha}")
first_tag = subprocess.check_output(
[GIT, "tag", "--sort=creatordate", "--contains", line_sha, "jenkins-*"],
text=True,
).split("\n", 1)[0]
if first_tag:
print(f"\tfirst tag was {first_tag}")
print(f"* first tag was {first_tag}")
commits_and_tags[line_sha] = first_tag
if not dry_run:
since_version = first_tag.replace("jenkins-", "")
Expand All @@ -75,10 +75,11 @@ def analyze_file(file, lineno, commits_and_tags, dry_run=False):

else:
print(
"\tNot updating file, no tag found. "
"* Not updating file, no tag found. "
"Normal if the associated PR/commit is not merged and released yet; "
"otherwise make sure to fetch tags from jenkinsci/jenkins"
)
print() # Add a newline for markdown rendering


def analyze_files(commits_and_tags, dry_run=False):
Expand Down

0 comments on commit f8e2844

Please sign in to comment.