diff --git a/.github/workflows/close-issues-when-done.yml b/.github/workflows/close-issues-when-done.yml new file mode 100644 index 0000000..1cfe68b --- /dev/null +++ b/.github/workflows/close-issues-when-done.yml @@ -0,0 +1,28 @@ +name: Close Issue on Done + +on: + project_card: + types: + - moved + +jobs: + close-issue: + runs-on: ubuntu-latest + + steps: + - name: Check if in "done" column + id: check-done-column + run: echo "::set-output name=isDone::${{ contains(github.event.project_card.column_name, 'done') }}" + + - name: Close Issue + if: steps.check-done-column.outputs.isDone == 'true' + uses: actions/github-script@v5 + with: + script: | + const issueId = context.payload.project_card.content_url.split('/').pop(); + await github.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueId, + state: 'closed' + });