A GitHub Action that sends a report of Optimizely flags by how recently they have been updated as a message on Slack.
To use this GitHub Action, you need to create a workflow file (e.g., .github/workflows/optimizely.yml
) in your repository. Here's an example workflow that sends a message every Tuesday at 10:00 am:
name: Send Optimizely Flags Report to Slack
on:
schedule:
- cron: "0 10 * * 2"
jobs:
send-optimizely-report:
runs-on: ubuntu-latest
steps:
- name: Generate and Send Optimizely Flags Report
uses: hitarthdesai/[email protected]
with:
optimizely_project_id: 1234567890
optimizely_auth_token: demo-optimizely-token-for-auth
slack_channel_id: CHANNEL123
slack_app_bot_token: demo-slack-token-for-bot
Name | Required | Default | Description |
---|---|---|---|
optimizely_project_id |
yes | N/A | The Optimizely project ID for which the action should generate the report. |
optimizely_auth_token |
yes | N/A | The Optimizely API token for authentication. It is used to fetch the flags and their last updated time. |
slack_channel_id |
yes | N/A | The Slack channel ID to which the action will send a message with the report. |
slack_app_bot_token |
yes | N/A | The Slack app bot token for authentication. It is used to fetch the user name and profile picture of the bot.secret |
permanent_flag_variable_name |
no | is_permanent |
Name of the optimizely variable that indicates if a particular flag is permanent or not. |
flag_end_date_variable_name |
no | end_date |
Name of the optimizely variable that indicates the date after which an Optimizely flag should be included in the report. |
As of now, the action offers the following options:
- You can add an Optimizely Variable named
is_permanent
with default valueTrue
to a feature flag if you don't want to be notified about it at all. - You can add an Optimizely Variable named
end_date
with default value in the formatMM,DD,YYYY
to indicate you don't want to be notified about this flag before the specified date.
Example: Use end_date=12,31,24
to not be notified before December 31, 2024
Following are the steps the action performs:
- Fetches all features flags from a Optimizely Feature Experimentation project using the
inputs.optimizely_project_id
andinputs.optimizely_auth_token
. - Excludes feature flags marked as permanent by checking if the variable
is_permanent
is set to true. If it is not specified, the flag will be considered non-permanent. - Excludes feature flags marked with an
end_date
that is after the day this action is being run - Groups the remaining feature flags into time ranges i.e.
TWO_WEEKS_OR_LESS, ONE_MONTH_OR_LESS, THREE_MONTHS_OR_LESS, SIX_MONTHS_OR_LESS, ONE_YEAR_OR_LESS, MORE_THAN_ONE_YEAR
- Build the slack message from the above classification, and sends it to
inputs.slack_channel_id
asinputs.slack_app_bot_token
using Slack API's post message endpoint.