Skip to content

Monthly recurring tickets #26

Monthly recurring tickets

Monthly recurring tickets #26

# Action to create tasks on a set schedule, from
# https://docs.github.com/en/actions/managing-issues-and-pull-requests/scheduling-issue-creation
name: Monthly recurring tickets
on:
workflow_dispatch:
schedule:
- cron: 0 1 1 * *
jobs:
create_issue:
name: Shopping cart update ticket
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Recurring ticket
run: |
if [[ $CLOSE_PREVIOUS == true ]]; then
previous_issue_number=$(gh issue list \
--label "$LABELS" \
--search "$TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close "$previous_issue_number"
gh issue unpin "$previous_issue_number"
fi
fi
new_issue_url=$(gh issue create \
--title "$TITLE" \
--assignee "$ASSIGNEES" \
--label "$LABELS" \
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
LABELS: "maintenance"
TITLE: "MONTHLY: Update shopping cart reports"
BODY: |
(created by `recurring_tasks_monthly.yml`)
PINNED: false
CLOSE_PREVIOUS: true
create_issue2:
name: Monthly reporting ticket
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Recurring reporting
run: |
if [[ $CLOSE_PREVIOUS == true ]]; then
previous_issue_number=$(gh issue list \
--label "$LABELS" \
--search "$TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue close "$previous_issue_number"
gh issue unpin "$previous_issue_number"
fi
fi
new_issue_url=$(gh issue create \
--title "$TITLE" \
--assignee "$ASSIGNEES" \
--label "$LABELS" \
--body "$BODY")
if [[ $PINNED == true ]]; then
gh issue pin "$new_issue_url"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
LABELS: "maintenance"
TITLE: "MONTHLY: Reporting"
BODY: |
- [ ] Monthly report for Dryad board
- [ ] GREI progress report
(created by `recurring_tasks_monthly.yml`)
PINNED: false
CLOSE_PREVIOUS: true