Monthly issue metrics #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Monthly issue metrics | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '9 0 * * 1' | |
permissions: | |
issues: write | |
pull-requests: read | |
jobs: | |
build: | |
name: issue metrics | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get dates for last month | |
shell: bash | |
run: | | |
# Calculate the first day of the previous month | |
first_day=$(date -d "last month" +%Y-%m-%d) | |
# 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" | |
- name: Run issue-metrics tool | |
uses: github/issue-metrics@v2 | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IGNORE_USERS: 'github-actions[bot]' | |
SEARCH_QUERY: 'repo:antvis/l7 is:issue created:${{ env.last_month }} -reason:"not planned"' | |
- name: Create issue | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: Monthly issue metrics report | |
token: ${{ secrets.GITHUB_TOKEN }} | |
content-filepath: ./issue_metrics.md | |
assignees: lzxue | |
- name: issue_metrics as parameter | |
id: read-file-content | |
run: | | |
# Read the content of the file into a variable | |
FILE_CONTENT=$(cat ./issue_metrics.md) | |
# Set the content as a parameter | |
echo "FILE_CONTENT=$FILE_CONTENT" >> $GITHUB_ENV | |
- name: Sync success after ding talk | |
uses: zcong1993/actions-ding@master | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
ignoreError: true | |
body: | | |
{ | |
"msgtype": "markdown", | |
"link": { | |
"title": "ISSUE 指标播报", | |
"markdown":{ | |
title: "ISSUE 指标播报", | |
text: ${{ env.PARAMETER_VALUE}} | |
} | |
} | |
} | |