misc updates #31
This file contains hidden or 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: Auto close issues | |
| on: | |
| push: | |
| branches: | |
| - data | |
| jobs: | |
| find-issues: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Get Issues List | |
| id: issues | |
| run: | | |
| lines_with_closes=$(git show -1 --pretty=%B | grep -E "Closes:") | |
| numbers=() | |
| while IFS= read -r line; do | |
| if [[ $line =~ ^Closes:\ (.+) ]]; then | |
| trimmed_line="${line#*#}" | |
| numbers+=($trimmed_line) | |
| fi | |
| done <<< "$lines_with_closes" | |
| json_array=$(printf '[%s]' "${numbers[@]}") | |
| echo $json_array | |
| echo "json_array=$json_array" >> "$GITHUB_OUTPUT" | |
| - name: Close all issues | |
| env: | |
| json_array: ${{ steps.issues.outputs.json_array }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo $json_array | jq -r 'map(tonumber) | .[]' | while read -r line; do | |
| number=$(echo $line | cut -d $'\r' -f 1) | |
| gh issue close $number | |
| done |