Skip to content

Commit

Permalink
Merge pull request #5266 from GeorgianaElena/auto-prj-management
Browse files Browse the repository at this point in the history
Automate reccurent tasks addition to the project board
  • Loading branch information
GeorgianaElena authored Dec 11, 2024
2 parents 3403544 + f0a07ee commit 3da4069
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 32 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/project-board-update.yml

This file was deleted.

41 changes: 37 additions & 4 deletions .github/workflows/recurrent-get-billing-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ jobs:
- name: Get the next month name
id: get_next_month
run: echo "next_month=$(date -d '+1 month' +'%B')" >> $GITHUB_ENV
echo "start_date_as_iso=$(date -d '+1 month' +'%Y-%m-02')" >> $GITHUB_ENV
echo "end_date_as_iso=$(date -d '+1 month' +'%Y-%m-07')" >> $GITHUB_ENV

- name: Create issue for dedicated clusters billing
run: |
gh issue create \
dedicated_issue = $(gh issue create \
--label "recurrent" \
--title "[Billing] Dedicated clusters: collect billing data for $NEXT_MONTH" \
--body "$BODY"
--body "$BODY")
echo "dedicated_issue=$dedicated_issue" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.PROJECT_BOARD_PAT_TOKEN }}
GH_REPO: ${{ github.repository }}
Expand All @@ -36,10 +39,11 @@ jobs:
- name: Create issue for shared clusters billing
run: |
gh issue create \
shared_issue = $(gh issue create \
--label "recurrent" \
--title "[Billing] Shared clusters: collect billing data for $NEXT_MONTH" \
--body "$BODY"
--body "$BODY")
echo "shared_issue=$shared_issue" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.PROJECT_BOARD_PAT_TOKEN }}
GH_REPO: ${{ github.repository }}
Expand All @@ -51,3 +55,32 @@ jobs:
### Definition of Done
- [ ] Billing data is collected according to instructions.
- [ ] The billing slack was notified about the new billing data collected
- name: Sleep a bit to allow issues to be added to the board by automation
run: sleep 3

- name: "Dedicated clusters: set the relevant project board fields"
uses: EndBug/project-fields@v2
id: set-fields
with:
operation: set
# If the fields name or type will change
# expect this step to fail
fields: Status,Estimate,Start date
github_token: ${{ secrets.PROJECT_BOARD_PAT_TOKEN }}
project_url: https://github.com/orgs/2i2c-org/projects/57
values: Up Next,1,${{ env.start_date_as_iso }}
resource_url: ${{ env.dedicated_issue }}

- name: "Shared clusters: set the relevant project board fields"
uses: EndBug/project-fields@v2
id: set-fields
with:
operation: set
# If the fields name or type will change
# expect this step to fail
fields: Status,Estimate,Start date,End date
github_token: ${{ secrets.PROJECT_BOARD_PAT_TOKEN }}
project_url: https://github.com/orgs/2i2c-org/projects/57
values: Up Next,2,${{ env.start_date_as_iso }},${{ env.end_date_as_iso }}
resource_url: ${{ env.shared_issue }}
32 changes: 25 additions & 7 deletions .github/workflows/recurrent-regenerate-smce-creds-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,28 @@ on:

jobs:
create_issue:
name: Create credentials regeneration issue
name: Create issue
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Get Deadline
id: get_deadline
# The deadline is 4 days after the issue is opened
run: echo "deadline=$(date -d '+4 days' +'%B %d')" >> $GITHUB_ENV
run: |
echo "deadline=$(date -d '+4 days' +'%B %d')" >> $GITHUB_ENV
echo "deadline_as_iso_date=$(date -d '+4 days' +"%Y-%m-%d")" >> $GITHUB_ENV
- name: Create credentials regeneration issue
- name: Create issue
run: |
gh issue create \
issue = $(gh issue create \
--label "recurrent" \
--title "[$DEADLINE] Regenerate SMCE credentials" \
--body "$BODY"
--title "[${{ env.deadline }}] Regenerate SMCE credentials" \
--body "$BODY")
echo "issue=$issue" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.PROJECT_BOARD_PAT_TOKEN }}
GH_REPO: ${{ github.repository }}
DEADLINE: ${{ env.deadline }}
BODY: |
The credentials of the deployer on SMCE clusters must be renewed every ~55 days.
Expand All @@ -44,3 +46,19 @@ jobs:
### Definition of Done
- [ ] There is a deadline for this task
- [ ] The credentials of the deployer on all 3 clusters have been renewed
- name: Sleep a bit to allow issue to be added to the board by automation
run: sleep 3

- name: Set the "Status" and "Estimate" project board fields
uses: EndBug/project-fields@v2
id: set-fields
with:
operation: set
# If the fields name or type will change
# expect this step to fail
fields: Status,Estimate,End date
github_token: ${{ secrets.PROJECT_BOARD_PAT_TOKEN }}
project_url: https://github.com/orgs/2i2c-org/projects/57
values: Up Next,1,${{ env.deadline_as_iso_date }}
resource_url: ${{ env.issue }}

0 comments on commit 3da4069

Please sign in to comment.