Skip to content

Commit

Permalink
dfsdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucifergene authored Apr 27, 2024
1 parent bf29190 commit ee72551
Show file tree
Hide file tree
Showing 8 changed files with 873 additions and 20 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/backstage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Backstage Daily JIRA Status

on:
push:
paths:
- 'backstage/**'
# Trigger on a cron schedule (every weekday at 4:00 PM IST)
schedule:
- cron: '30 10 * * 1-5' # Adjusted for 4:00 PM IST in UTC
workflow_dispatch: # Allow manual triggering of the workflow

jobs:
run-script:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run Bash Script
run: bash backstage/team-backstage.sh ${{ secrets.PERSONAL_SLACK_HOOK }}
7 changes: 5 additions & 2 deletions .github/workflows/devconsole.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: ODC Daily JIRA Status

on:
push:
branches:
- main # Trigger the workflow on push events to the main branch
paths:
- 'devconsole/**'
# Trigger on a cron schedule (every weekday at 10:00 AM IST)
schedule:
- cron: '30 4 * * 1-5' # Adjusted for 10:00 AM IST in UTC
workflow_dispatch: # Allow manual triggering of the workflow

jobs:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/konflux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Konflux Daily JIRA Status

on:
push:
paths:
- 'konflu/**'
# Trigger on a cron schedule (every weekday at 10:00 AM IST)
schedule:
- cron: '30 4 * * 1-5' # Adjusted for 10:00 AM IST in UTC
workflow_dispatch: # Allow manual triggering of the workflow

jobs:
run-script:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run Bash Script
run: bash konflu/forum-konflu-ui.sh ${{ secrets.JIRA_PAT }} ${{ secrets.PERSONAL_SLACK_HOOK }}
18 changes: 0 additions & 18 deletions .github/workflows/rhtap.yml

This file was deleted.

146 changes: 146 additions & 0 deletions backstage/team-backstage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
set -e

echo "Generating Status Report"

head="\nBackstage GitHub Status"

PREVIOUS_DT=`date -v -7d "+%F"`

echo "Fetching Github data"

url1="https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-showcase+state%3Aopen+type%3Apr+created%3A<$PREVIOUS_DT&type=Issues"
url2="https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-plugins+state%3Aopen+type%3Apr+created%3A<$PREVIOUS_DT&type=Issues"
url3="https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fjanus-idp.github.io+state%3Aopen+type%3Apr+created%3A<$PREVIOUS_DT&type=Issues"

showcase_github_data="\n<https://github.com/search?l=&q=repo%3Ajanus-idp%2Fbackstage-showcase+state%3Aopen+type%3Apr | Total open PRs>: $(curl -s 'https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-showcase+state%3Aopen+type%3Apr' -H "Accept: application/json" | jq '.total_count // 0')"
showcase_github_data+="\n<https://github.com/search?q=repo%3Ajanus-idp%2Fbackstage-showcase+state%3Aopen+type%3Apr+created%3A%3C$PREVIOUS_DT&type=Issues | PRs opened for more than a week>: $(curl -s $url1 -H "Accept: application/json" | jq '.total_count // 0')"

plugins_github_data="\n<https://github.com/search?l=&q=repo%3Ajanus-idp%2Fbackstage-plugins+state%3Aopen+type%3Apr | Total open PRs>: $(curl -s 'https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fbackstage-plugins+state%3Aopen+type%3Apr' -H "Accept: application/json" | jq '.total_count // 0')"
plugins_github_data+="\n<https://github.com/search?q=repo%3Ajanus-idp%2Fbackstage-plugins+state%3Aopen+type%3Apr+created%3A%3C$PREVIOUS_DT&type=Issues | PRs opened for more than a week>: $(curl -s $url2 -H "Accept: application/json" | jq '.total_count // 0')"

janusidp_github_data="\n<https://github.com/search?l=&q=repo%3Ajanus-idp%2Fjanus-idp.github.io+state%3Aopen+type%3Apr | Total open PRs>: $(curl -s 'https://api.github.com/search/issues?q=repo%3Ajanus-idp%2Fjanus-idp.github.io+state%3Aopen+type%3Apr' -H "Accept: application/json" | jq '.total_count // 0')"
janusidp_github_data+="\n<https://github.com/search?q=repo%3Ajanus-idp%2Fjanus-idp.github.io+state%3Aopen+type%3Apr+created%3A%3C$PREVIOUS_DT&type=Issues | PRs opened for more than a week>: $(curl -s $url3 -H "Accept: application/json" | jq '.total_count // 0')"

echo "Posting on slack"

data='{
text: 'GitHub Status report',
blocks: [
{
"type": 'header',
text: {
"type": 'plain_text',
text: head
}
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: '*backstage-showcase*'
}
]
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: github_data_a
},
]
},
{
"type": 'divider'
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: '*backstage-plugins*'
}
]
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: github_data_b
},
]
},
{
"type": 'divider'
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: '*janus-idp.github.io*'
}
]
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: github_data_c
},
]
},
{
"type": 'divider'
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: '*operator*'
}
]
},
{
"type": 'section',
fields: [
{
"type": 'mrkdwn',
text: github_data_d
},
]
},
{
"type": 'divider'
},
{
"type": "section",
fields: [
{
"type": "mrkdwn",
text: "*red-hat-developers-documentation-rhdh*",
},
],
},
{
"type": "section",
fields: [
{
"type": "mrkdwn",
text: github_data_e,
},
],
},
{
"type": "divider",
},
]
}'

curl -X POST -H "Content-type:application/json" --data "$data" $1

echo "\nDone"
Loading

0 comments on commit ee72551

Please sign in to comment.