mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Apply suggested changes
This commit is contained in:
parent
a257fddf24
commit
cf85b0e5e1
45
.github/actions/query_issues/action.yml
vendored
45
.github/actions/query_issues/action.yml
vendored
@ -1,15 +1,16 @@
|
||||
name: Query issues using GraphQL API
|
||||
inputs:
|
||||
token:
|
||||
description: 'The GITHUB_TOKEN secret'
|
||||
github_token:
|
||||
description: 'GitHub API token'
|
||||
required: true
|
||||
query:
|
||||
description: "The GraphQL search query to be executed"
|
||||
filter:
|
||||
# Filter syntax: https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests
|
||||
description: "The search filter for issues."
|
||||
required: true
|
||||
type: string
|
||||
outputs:
|
||||
query_result:
|
||||
description: "The result of the query"
|
||||
description: "The result of the query (JSON)"
|
||||
value: ${{ steps.get_issues.outputs.query_result }}
|
||||
|
||||
runs:
|
||||
@ -18,23 +19,25 @@ runs:
|
||||
- id: get_issues
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ inputs.token }}
|
||||
GH_TOKEN: ${{ inputs.github_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
|
||||
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
|
||||
|
36
.github/actions/stale_issues/action.yml
vendored
36
.github/actions/stale_issues/action.yml
vendored
@ -1,13 +1,12 @@
|
||||
name: Filter stale issues
|
||||
name: Find stale issues
|
||||
inputs:
|
||||
token:
|
||||
description: 'The GITHUB_TOKEN secret'
|
||||
github_token:
|
||||
description: 'GitHub API token'
|
||||
required: true
|
||||
period:
|
||||
description: "The stale period in days"
|
||||
inactivity_period:
|
||||
description: "The inactivity period in days"
|
||||
required: false
|
||||
type: number
|
||||
default: 14
|
||||
repo:
|
||||
description: "The target repository"
|
||||
required: false
|
||||
@ -15,35 +14,38 @@ inputs:
|
||||
default: "${{ github.repository_owner }}/${{ github.event.repository.name }}"
|
||||
outputs:
|
||||
result:
|
||||
description: "The result of the query"
|
||||
description: "List of issue URLs. The list is in a format suitable for iteration with a shell loop, i.e. escaped and separated with whitespace."
|
||||
value: ${{ steps.found_issues.outputs.result }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Get period date
|
||||
- name: Get a concrete cut-off date matching the inactivity period
|
||||
id: date
|
||||
shell: bash
|
||||
run: |
|
||||
period_date=$(date --date "${{ inputs.period }} days ago" --utc +"%Y-%m-%dT%H:%M:%SZ")
|
||||
echo "period=$period_date" >> $GITHUB_OUTPUT
|
||||
inactivity_period_date=$(date --date "${{ inputs.inactivity_period }} days ago" --utc +"%Y-%m-%dT%H:%M:%SZ")
|
||||
echo "inactivity_period=$inactivity_period_date" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get inactive open issues
|
||||
id: stale_issues
|
||||
if: ${{ success() }}
|
||||
uses: ethereum/solidity/.github/actions/query_issues@develop
|
||||
with:
|
||||
token: ${{ inputs.token }}
|
||||
query: 'repo:${{ inputs.repo }} is:issue is:open updated:<${{ steps.date.outputs.period }}'
|
||||
github_token: ${{ inputs.github_token }}
|
||||
query: 'repo:${{ inputs.repo }} is:issue is:open updated:<${{ steps.date.outputs.inactivity_period }}'
|
||||
|
||||
- name: Collect query result
|
||||
id: found_issues
|
||||
if: ${{ success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
filter_result=$(
|
||||
jq --raw-output \
|
||||
--null-input \
|
||||
--argjson result '${{ steps.stale_issues.outputs.query_result }}' \
|
||||
'[$result.data.search.nodes[].url] | @sh' \
|
||||
| tr --delete \'
|
||||
jq \
|
||||
--raw-output \
|
||||
--null-input \
|
||||
--argjson result '${{ steps.stale_issues.outputs.query_result }}' \
|
||||
'[$result.data.search.nodes[].url] | @sh' \
|
||||
| tr --delete \'
|
||||
)
|
||||
echo "result=$filter_result" >> $GITHUB_OUTPUT
|
||||
|
22
.github/workflows/stale-issues.yml
vendored
22
.github/workflows/stale-issues.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Check stale issues
|
||||
name: Ping and close stale issues
|
||||
|
||||
on:
|
||||
workflow_dispatch: # FIXME: remove
|
||||
@ -6,8 +6,8 @@ on:
|
||||
- cron: '0 12 * * *'
|
||||
|
||||
env:
|
||||
PERIOD: 14 # in days
|
||||
WAIT_FOR_INFO: "waiting for more input"
|
||||
INACTIVITY_PERIOD: 14 # in days
|
||||
WAIT_FOR_INFO_LABEL: "waiting for more input"
|
||||
DRY_RUN: true
|
||||
|
||||
jobs:
|
||||
@ -16,12 +16,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get inactive open issues
|
||||
id: stale_issues
|
||||
uses: ./.github/actions/stale_issues
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
period: ${{ env.PERIOD }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
inactivity_period: ${{ env.INACTIVITY_PERIOD }}
|
||||
|
||||
- name: Comment on found issues
|
||||
if: ${{ success() }}
|
||||
env:
|
||||
@ -29,10 +31,12 @@ jobs:
|
||||
run: |
|
||||
for issue_url in ${{ steps.stale_issues.outputs.result }}; do
|
||||
# Filter stale issues that were triaged and are not waiting for more information
|
||||
stale_triaged=$(gh issue view $issue_url \
|
||||
--json labels \
|
||||
--jq '.labels | map(.name != "$WAIT_FOR_INFO") | all and length > 0')
|
||||
if [[ $stale_triaged == 'true' ]]; then
|
||||
is_stale=$(
|
||||
gh issue view $issue_url \
|
||||
--json labels \
|
||||
--jq '.labels | map(.name != "$WAIT_FOR_INFO_LABEL") | all and length > 0'
|
||||
)
|
||||
if [[ $is_stale == 'true' ]]; then
|
||||
if [[ $DRY_RUN == 'true' ]]; then
|
||||
echo "Commenting on issue: $issue_url"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user