diff --git a/.github/workflows/reject_subscriptions.yaml b/.github/workflows/reject_subscriptions.yaml new file mode 100644 index 0000000..7e3c74d --- /dev/null +++ b/.github/workflows/reject_subscriptions.yaml @@ -0,0 +1,29 @@ +name: Process survey's entry +on: + issues: + types: [ opened ] + +jobs: + reject_subscriptions: + runs-on: ubuntu-latest + if: contains(github.event.issue.title, '[auto] - ') + steps: + - name: Add comment + run: gh issue comment "$NUMBER" --body "$BODY" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + BODY: > + Registrations are now closed, come back next year. + + - name: Closing issue + run: | + gh api \ + --method PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/osscameroon/careathon-2024/issues/$ISSUE_NUMBER \ + "state=closed" -f "labels[]=registration_closed" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}