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
Create issue metrics workflow #278
base: dev
Are you sure you want to change the base?
Conversation
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.
@anupdsouza I have a few questions just looking over the yml file, I haven't done this before, but just looking at the workflow you've written so far I wanted to clarify some of it, for my understanding
To set up auto trigger via cron jobs, just add the following under workflow_dispatch:
Is it possible for GitHub actions to trigger this, rather than it running as a cron job?
- name: Run issue-metrics tool for opened issues last week | ||
uses: github/issue-metrics@v2 | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 I need to do anything with this? Do I need to create some kind of secret for this to be able to create issues?
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.
Not required, as per Github documentation:
If you want the resulting issue with the metrics in it to appear in a different repository other than the one the workflow file runs in, update the line token: ${{ secrets.GITHUB_TOKEN }} with your own GitHub API token stored as a repository secret.
# Calculate the first day of the previous month | ||
#first_day=$(date -d "last month" +%Y-%m-01) | ||
|
||
# Calculate the last day of the previous month | ||
#last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) | ||
|
||
#Set an environment variable with the date range | ||
#echo "$first_day..$last_day" | ||
#echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" |
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.
Is this used for anything? It looks like it's all commented out?
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.
Not used at the moment. I left it in as a reference if you wanted to update the workflow such that it'd fetch reports for the previous month instead of the previous week.
- name: Create issue for opened issues | ||
uses: peter-evans/create-issue-from-file@v4 | ||
with: | ||
title: ${{ env.prev_week }} opened issues |
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 I need an environment variable of some kind? This looks like it's referencing 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.
No, it's defined on line 28.
As per Github documentation, the example uses cron job to schedule it to run once a month.
I suppose the workflow could be updated to run every time PR's are created or merged by doing something like this:
but that would result in too many reports being generated. That's why I left it to be run manually. |
What it Does
How I Tested
Notes
Screenshots