-
Notifications
You must be signed in to change notification settings - Fork 216
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
Update monthly-issue-metircs.yml #1062
Conversation
automatically add the monthly-report metrics label
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WalkthroughThe pull request updates the GitHub Actions workflow for generating the "Monthly Issue Metrics Report." It introduces new steps to handle closed issues, including running the issue-metrics tool for closed issues and creating a corresponding issue report. The modifications maintain the existing job structure while ensuring that both opened and closed issues are reported with appropriate labeling. Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
.github/workflows/monthly-issue-metircs.yml (2)
Line range hint
1-1
: Fix typo in workflow filenameThe workflow filename contains a typo: "metircs" should be "metrics". Consider renaming the file from
monthly-issue-metircs.yml
tomonthly-issue-metrics.yml
.
Line range hint
1-67
: Consider refactoring to reduce code duplicationThe workflow contains duplicate steps for opened and closed issues that only differ in their search query and title. Consider refactoring using GitHub Actions matrix strategy to make the workflow more maintainable.
Here's how you could refactor the workflow:
name: Monthly Issue Metrics Report on: workflow_dispatch: schedule: - cron: '0 0 1 * *' permissions: issues: write pull-requests: read jobs: build: name: docs issue metrics runs-on: ubuntu-latest + strategy: + matrix: + issue_type: [opened, closed] steps: - name: Get dates for last month shell: bash run: | first_day=$(date -d "last month" +%Y-%m-01) last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" - name: Run issue-metrics tool for issues last month uses: github/issue-metrics@v2 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:ethereum-optimism/docs is:issue created:${{ env.last_month }} -reason:"not planned" -label:monthly-report' + SEARCH_QUERY: >- + repo:ethereum-optimism/docs is:issue + ${{ matrix.issue_type == 'opened' && 'created' || 'closed' }}:${{ env.last_month }} + -reason:"not planned" + -label:monthly-report - name: Create issue uses: peter-evans/create-issue-from-file@v4 with: - title: ${{ env.last_month }} metrics report for opened issues + title: ${{ env.last_month }} metrics report for ${{ matrix.issue_type }} issues content-filepath: ./issue_metrics.md assignees: sbvegan labels: | monthly-report - - - name: Run issue-metrics tool for issues last month - uses: github/issue-metrics@v2 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:ethereum-optimism/docs is:issue closed:${{ env.last_month }} -reason:"not planned" -label:monthly-report' - - - name: Create issue for closed issues - uses: peter-evans/create-issue-from-file@v4 - with: - title: ${{ env.last_month }} metrics report for closed issues - content-filepath: ./issue_metrics.md - assignees: sbvegan - labels: | - monthly-reportThis refactoring:
- Uses matrix strategy to handle both opened and closed issues
- Eliminates code duplication
- Makes future modifications easier to maintain
- Reduces the chance of inconsistencies between the two report generations
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/monthly-issue-metircs.yml
(1 hunks)
🔇 Additional comments (1)
.github/workflows/monthly-issue-metircs.yml (1)
44-45
: LGTM: Labels implementation is correct
The addition of the monthly-report
label is properly implemented using the YAML multi-line syntax.
automatically add the monthly-report metrics label
Description
Tests
Additional context
Metadata