-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
ICU-23056 Add workflow to generate commit checker report #3413
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: BRS Commit Checker Report | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
fix_version: | ||
type: string | ||
required: true | ||
description: The ICU Jira "Fix Version" semver | ||
from_git_ref: | ||
type: string | ||
required: true | ||
description: The git ref start of comparison range. Prefix branches with `origin/`. | ||
end_git_ref: | ||
type: string | ||
required: true | ||
description: The git ref end of comparison range. Must be descendant of `from_git_ref`. Prefix branches with `origin/`. | ||
# Jira user name & API token is used for processing sensitive tickets comes from Github Secrets | ||
# stored in the repository | ||
|
||
jobs: | ||
commit-report: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
fetch-depth: 0 | ||
# workaround for bug in checkout action. this step should be redundant. | ||
# https://github.com/actions/checkout/issues/1471 | ||
# https://github.com/actions/checkout/issues/1781 | ||
# https://github.com/actions/checkout/issues/701#issuecomment-1133937950 | ||
- name: Fetch all tags | ||
run: | | ||
git fetch --tags origin | ||
- name: Fetch all branches | ||
run: | | ||
git fetch origin | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12.8' | ||
cache: 'pipenv' | ||
cache-dependency-path: | | ||
tools/commit-checker/Pipfile | ||
tools/commit-checker/Pipfile.lock | ||
- name: Install pipenv | ||
run: | | ||
sudo pip3 install pipenv | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't I did a very quick scan of several articles and there seems to be agreement that But I've also seen several recommendations to start with More power often means added complexity :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I considered that out of scope. This is just automating the existing instructions. I also don't know enough about either to comment, but I would be interested to learn more, assuming that this topic is orthogonal to the objective of the PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wrote this script and chose pipenv due to its simplicity and reproducibility. It behaves more like a modern package manager. I've tried many ways to install Python dependencies and this is by far my favorite. I don't like venv because you make a profile global to the system user. Pipenv makes a profile local to the project directory, as it should be. (I think it uses venv under the hood but what's surfaced to the user is a project-local environment.) |
||
- name: Generate report | ||
env: | ||
JIRA_USERNAME: ${{ secrets.COMMIT_CHECKER_JIRA_EMAIL }} | ||
JIRA_PASSWORD: ${{ secrets.COMMIT_CHECKER_JIRA_TOKEN }} | ||
run: | | ||
pushd ./tools/commit-checker | ||
pipenv install | ||
pipenv run python3 check.py \ | ||
--jira-query "project=ICU AND fixVersion=${{ inputs.fix_version }}" \ | ||
--rev-range "${{ inputs.from_git_ref }}..${{ inputs.end_git_ref }}" > REPORT.md | ||
popd | ||
# https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/ | ||
- name: Reproduce report as workflow job summary | ||
run: | | ||
cat ./tools/commit-checker/REPORT.md >> $GITHUB_STEP_SUMMARY | ||
echo "View the Summary page of this GHA Workflow instance to view the rendered Markdown of this report." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this to be so flexible, from git-ref to git-ref?
Working with tags would be a lot easier and more readable
(think from
release-76-1
torelease-77-rc
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This derives from how git works. When you issue a command (ex:
checkout
,reset
, etc.), what you provide as an argument is called a git ref. If "ref" is an interface/supertype, then concrete types of a ref include tags, commit hashes, and branch names.As you know, with git, the implementation is the specification. So I presume the flexibility comes from git.
I also personally don't think the the flexibility is a problem in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean that I can use
release-76-rc
?And that's a git-ref in GitHub lingo?
In fact in git a tag is basically an alias to a ref, or a pointer to a ref (however you want to look at it)
So maybe it's not really a GitHub lingo, but a git one :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,
release-76-rc
is a git tag, which is concrete type of a git ref, so it will work. And yes, that's an underlying git thing, not a Github-specific thing.