New CFE workflow notifications
This commit is contained in:
parent
ca3aad0313
commit
8cd27c4c43
|
@ -0,0 +1,130 @@
|
|||
name: New CFE workflow notifications
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
cfe-created:
|
||||
if: github.event.label.name == 'code freeze exception'
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Debug GitHub Context
|
||||
run: |
|
||||
echo "${{ toJson(github) }}"
|
||||
|
||||
- name: Notify Slack
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_CORE_RELESES_DAILY_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:arrow_right: New CFE request: ${{ github.event.issue.title }}
|
||||
${{ github.event.issue.html_url }}
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
cfe-approved:
|
||||
if: github.event.label.name == 'CFE Approved'
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Extract PR URL from issue body
|
||||
id: extract-pr
|
||||
run: |
|
||||
PR_URL=$(echo "${{ github.event.issue.body }}" | grep -oP 'https://github.com/[^/]+/[^/]+/pull/\d+')
|
||||
|
||||
if [[ -z "$PR_URL" ]]; then
|
||||
echo "No valid PR URL found in the issue body. Exiting."
|
||||
exit 1
|
||||
else
|
||||
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Add label 'cherry pick to trunk' to PR
|
||||
run: |
|
||||
gh pr edit $PR_URL --add-label "cherry pick to trunk"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_URL: ${{ env.PR_URL }}
|
||||
|
||||
- name: Extract Release Number from Issue Body
|
||||
id: extract-release
|
||||
run: |
|
||||
RELEASE_NUMBER=$(echo "${{ github.event.issue.body }}" | grep -oP '\b\d+\.\d+\b')
|
||||
if [[ -z "$RELEASE_NUMBER" ]]; then
|
||||
echo "No valid release number found in the issue body. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
echo "RELEASE_NUMBER=$RELEASE_NUMBER" >> $GITHUB_ENV
|
||||
echo "Extracted Release Number: $RELEASE_NUMBER"
|
||||
|
||||
- name: Apply Milestone to the Issue
|
||||
run: |
|
||||
MILESTONE="$RELEASE_NUMBER.0"
|
||||
echo "Applying milestone: $MILESTONE"
|
||||
gh issue edit ${{ github.event.issue.html_url }} --milestone "$MILESTONE"
|
||||
env:
|
||||
RELEASE_NUMBER: ${{ env.RELEASE_NUMBER }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Notify Slack
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_CORE_RELESES_DAILY_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:white_check_mark: CFE request approved: ${{ github.event.issue.title }}
|
||||
${{ github.event.issue.html_url }}
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
||||
continue-on-error: true
|
||||
|
||||
cfe-rejected:
|
||||
if: github.event.label.name == 'CFE Rejected'
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Extract Release Number from Issue Body
|
||||
id: extract-release
|
||||
run: |
|
||||
RELEASE_NUMBER=$(echo "${{ github.event.issue.body }}" | grep -oP '\b\d+\.\d+\b')
|
||||
if [[ -z "$RELEASE_NUMBER" ]]; then
|
||||
echo "No valid release number found in the issue body. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
echo "RELEASE_NUMBER=$RELEASE_NUMBER" >> $GITHUB_ENV
|
||||
echo "Extracted Release Number: $RELEASE_NUMBER"
|
||||
|
||||
- name: Apply Milestone to the Issue
|
||||
run: |
|
||||
MILESTONE="$RELEASE_NUMBER.0"
|
||||
echo "Applying milestone: $MILESTONE"
|
||||
gh issue edit ${{ github.event.issue.html_url }} --milestone "$MILESTONE"
|
||||
env:
|
||||
RELEASE_NUMBER: ${{ env.RELEASE_NUMBER }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Close CFE Issue
|
||||
run: gh issue close --comment "Closing issue as CFE is rejected - ${{ github.event.issue.html_url }}" "${{ github.event.issue.html_url }}"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Notify Slack
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_CORE_RELESES_DAILY_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:x: CFE request rejected: ${{ github.event.issue.title }}
|
||||
${{ github.event.issue.html_url }}
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
||||
continue-on-error: true
|
Loading…
Reference in New Issue