Skip to content

Commit

Permalink
Merge branch 'main' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Jan 9, 2025
2 parents 9d0c622 + 7ccf726 commit 933300a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,9 @@ jobs:
prerelease: ${{ contains(env.TAG, 'rc') }}
files: |
dist/*
- name: Add PR comments on release
env:
GH_TOKEN: ${{ github.token }}
run: |
./scripts/add_pr_comments_on_release.sh
29 changes: 29 additions & 0 deletions src/scripts/add_pr_comments_on_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -e

repo_url=https://github.com/allenai/OLMo-core
tags=$(git tag -l --sort=-version:refname 'v*' | head -n 2)
current_tag=$(echo "$tags" | head -n 1)
last_tag=$(echo "$tags" | tail -n 1)

echo "Current release: $current_tag"
echo "Last release: $last_tag"

if [ -z "$last_tag" ]; then
echo "No previous release, nothing to do"
exit 0;
fi

commits_since_last_release=$(git log "${last_tag}..${current_tag}" --format=format:%H)

echo "Commits/PRs since last release:"
for commit in $commits_since_last_release; do
pr_number=$(gh pr list --search "$commit" --state merged --json number --jq '.[].number')
if [ -z "$pr_number" ]; then
echo "$commit"
else
echo "$commit (PR #$pr_number)"
gh pr comment "$pr_number" --body "This PR has been released in [${current_tag}](${repo_url}/releases/tag/${current_tag})."
fi
done

0 comments on commit 933300a

Please sign in to comment.