Monthly recurring tickets #27
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
| # 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 |