AWS Lambda Layer v79 #64
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Slack Post | |
| on: | |
| workflow_dispatch: # Manual trigger | |
| inputs: | |
| github_ref: | |
| description: 'Manually provided value for GITHUB_RELEASE_TAG of a release' | |
| required: true | |
| type: string | |
| # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release | |
| release: | |
| types: [published, released] | |
| jobs: | |
| notify-slack: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history to access commit messages | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.13' | |
| - name: Install dependencies | |
| run: | | |
| pip install httpx PyGithub | |
| # Set environment variables safely | |
| - name: Set event name | |
| id: set-event-name | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: echo "EVENT_NAME=$EVENT_NAME" >> $GITHUB_ENV | |
| # Handle workflow_dispatch event | |
| - name: Set GitHub ref for workflow dispatch | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| env: | |
| INPUT_REF: ${{ inputs.github_ref }} | |
| run: echo "GITHUB_RELEASE_TAG=$INPUT_REF" >> $GITHUB_ENV | |
| # Handle release event | |
| - name: Set GitHub ref for release event | |
| if: ${{ github.event_name != 'workflow_dispatch' }} | |
| env: | |
| GH_REF: ${{ github.ref }} | |
| run: | | |
| REF_NAME=$(basename "$GH_REF") | |
| echo "GITHUB_RELEASE_TAG=$REF_NAME" >> $GITHUB_ENV | |
| # Send notification using the safely set environment variables | |
| - name: Send Slack notification | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SLACK_TOKEN: ${{ secrets.RUPY_TRACER_RELEASES_TOKEN }} | |
| SLACK_SERVICE: ${{ secrets.RUPY_TRACER_RELEASES_CHANNEL_ID }} | |
| SLACK_TEAM: ${{ secrets.RUPY_TOWN_CRIER_SERVICE_ID }} | |
| run: | | |
| echo "New release published ${GITHUB_RELEASE_TAG}" | |
| python .github/scripts/announce_release_on_slack.py | |