Skip to content

[GH Request] Onboard @ChrisChV #1006

[GH Request] Onboard @ChrisChV

[GH Request] Onboard @ChrisChV #1006

# This workflow runs when a ticket is created.
# It adds the github-request label, tags on-call, and posts in Axim's internal slack channel.
#
# Separately, Axim's project board (https://github.com/orgs/openedx/projects/8)
# automatically adds all issues from this repo.
name: Label, tag, and notify on-call
on:
issues:
types: [opened]
env:
ORGANIZATION: openedx
jobs:
# Add a label to all issues that don't have it already (the template adds it automatically...
# but only if the requester has triage access on this repo).
# TODO: We used to add this label only to issues which were created from the on-call template.
# Since May 2024, we only use this repo for on-call issues, so we just add the label to everything.
# Once we've cleaned out our backlog of non-oncall issues from this repo, we can phase out
# this label entirely.
add_label:
runs-on: ubuntu-latest
# This is defined on all 2 jobs - so need to change x2 if changing this.
if: ${{ !contains(github.event.issue.labels.*.name, 'github-request') }}
steps:
- name: apply github-request label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: github-request
# TODO: We could probably do this with CODEOWNERS and some premade GitHub<->Slack integration.
tag_and_notify:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GRAPHQL_AUTH_APP_ID }}
private_key: ${{ secrets.GRAPHQL_AUTH_APP_PEM }}
- name: Tag axim on-call
env:
URL: ${{ github.event.issue.comments_url }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
curl \
-X POST \
$URL \
-H "Content-Type: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
--data '{ "body": "Thank you for your report! @openedx/axim-oncall will triage within a business day. Simple requests usually take 2-3 business days to resolve; more complex requests could take longer." }'
- name: Alert in Slack
id: slack
uses: slackapi/[email protected]
with:
channel-id: C02MB2TBKE3
# In the Slack message, we *could* just use ${{ github.event.issue.html_url }}.
# However, this creates a URL like:
# https://github.com/openedx/axim-engineering/issues/NUMBER
# which Slack will expand into a preview, clogging up our Slack channel. Unfortunately, there is no way
# to disable github.com previews without disabling all GitHub previews in the entire workspace.
# However, if we build the URL like this:
# https://www.github.com/openedx/axim-engineering/issues/NUMBER
# then the "www" trips up Slack enough so that it doesn't render the preview.
slack-message: "Incoming GitHub request: ${{ github.event.issue.title }}\nAuthor: ${{ github.event.issue.user.login }}\nURL: https://www.github.com/openedx/axim-engineering/issues/${{ github.event.issue.number }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ISSUE_BOT_TOKEN }}