mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add reusable query-issues action
This commit is contained in:
parent
98307e7f3a
commit
f082861df8
40
.github/workflows/actions/query-issues/action.yml
vendored
Normal file
40
.github/workflows/actions/query-issues/action.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: Query issues using GraphQL API
|
||||||
|
inputs:
|
||||||
|
token:
|
||||||
|
description: 'The GITHUB_TOKEN secret'
|
||||||
|
required: true
|
||||||
|
query:
|
||||||
|
description: "The GraphQL search query to be executed"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
outputs:
|
||||||
|
query_result:
|
||||||
|
description: "The result of the query"
|
||||||
|
value: ${{ steps.get_issues.outputs.query_result }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- id: get_issues
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ inputs.token }}
|
||||||
|
run: |
|
||||||
|
result="$(gh api graphql \
|
||||||
|
--field search_query="${{ inputs.query }}" \
|
||||||
|
--raw-field query='
|
||||||
|
query($search_query: String!, $cursor: String) {
|
||||||
|
search(first: 100, query: $search_query, type: ISSUE, after: $cursor) {
|
||||||
|
pageInfo {
|
||||||
|
hasNextPage,
|
||||||
|
endCursor
|
||||||
|
}
|
||||||
|
nodes {
|
||||||
|
... on Issue {
|
||||||
|
title
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}')"
|
||||||
|
echo "query_result=$result" >> $GITHUB_OUTPUT
|
37
.github/workflows/report-stale-issues.yml
vendored
37
.github/workflows/report-stale-issues.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Report stale triaged issues
|
name: Report stale issues
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -7,38 +7,47 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
PERIOD: 14 # in days
|
PERIOD: 14 # in days
|
||||||
WAIT_FOR_INFO: "waiting for more info"
|
REPO: "${{ github.repository_owner }}/${{ github.event.repository.name }}"
|
||||||
|
WAIT_FOR_INFO: "waiting for more input"
|
||||||
DRY_RUN: true
|
DRY_RUN: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-status:
|
check-issue-status:
|
||||||
name: Retrieve all open issues that are inactive for more than ${{ env.PERIOD }} days
|
name: Retrieve all open issues that are inactive
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v2.5.0
|
||||||
- name: Get period date
|
- name: Get period date
|
||||||
id: date
|
id: date
|
||||||
run: |
|
run: |
|
||||||
period_date=$(date -d "${{ env.PERIOD }} days ago" -u +"%Y-%m-%dT%H:%M:%SZ")
|
period_date=$(date -d "$PERIOD days ago" -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
echo "::set-output name=period::$period_date"
|
echo "period=$period_date" >> $GITHUB_OUTPUT
|
||||||
- name: Get inactive open issues
|
- name: Get inactive open issues
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
id: stale-issues
|
id: stale_issues
|
||||||
uses: lee-dohm/select-matching-issues@v1
|
uses: ./.github/actions/query-issues
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
query: 'is:issue is:open updated:<${{ steps.date.outputs.period }}'
|
query: 'repo:${{ env.REPO }} is:issue is:open updated:<${{ steps.date.outputs.period }}'
|
||||||
- name: Comment on found issues
|
- name: Comment on found issues
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
for issue_url in $(cat ${{ steps.stale-issues.outputs.path }}); do
|
query_result=$(
|
||||||
# Filter issues that were triaged and are not waiting for more info
|
jq --raw-output \
|
||||||
|
--null-input \
|
||||||
|
--argjson result '${{ steps.stale_issues.outputs.query_result }}' \
|
||||||
|
'[$result.data.search.nodes[].url] | @sh' \
|
||||||
|
| tr -d \'
|
||||||
|
)
|
||||||
|
for issue_url in $query_result; do
|
||||||
|
# Filter issues that were triaged and are not waiting for more information
|
||||||
stale_triaged=$(gh issue view $issue_url \
|
stale_triaged=$(gh issue view $issue_url \
|
||||||
--json labels \
|
--json labels \
|
||||||
--jq '.labels | map(.name != "${{ env.WAIT_FOR_INFO }}") | all and length > 0')
|
--jq '.labels | map(.name != "$WAIT_FOR_INFO") | all and length > 0')
|
||||||
if [[ "$stale_triaged" == "true" ]]; then
|
if [[ $stale_triaged == 'true' ]]; then
|
||||||
if [[ "${{ env.DRY_RUN }}" == "true" ]]; then
|
if [[ $DRY_RUN == 'true' ]]; then
|
||||||
echo "Commenting on issue: $issue_url"
|
echo "Commenting on issue: $issue_url"
|
||||||
else
|
else
|
||||||
gh issue comment $issue_url --body "Hey, devs! I have been waiting for too long. Please give me some attention! :-)"
|
gh issue comment $issue_url --body "Hey, devs! I have been waiting for too long. Please give me some attention! :-)"
|
||||||
|
Loading…
Reference in New Issue
Block a user