Skip to content

Bump slackapi/slack-github-action from 1.26.0 to 1.27.0 (#219) #297

Bump slackapi/slack-github-action from 1.26.0 to 1.27.0 (#219)

Bump slackapi/slack-github-action from 1.26.0 to 1.27.0 (#219) #297

Workflow file for this run

name: Run tests
on:
pull_request:
push:
branches:
- "main"
jobs:
build:
runs-on: ubuntu-latest
environment: Deploy
steps:
- name: Get starting time for reporting
id: start
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry and run tests
run: |
git tag 0.0.0.dev
pip install poetry
poetry config virtualenvs.in-project true
make install
. .venv/bin/activate
make test
- name: Record job data for Pull Request
if: ${{ github.event_name == 'pull_request' }}
run: |
end_time=$(date +%s)
start_time=${{ steps.start.outputs.start_time }}
elapsed_time=$(($end_time-$start_time))
formatted_time=$(date -u -d @$elapsed_time +"%M:%S")
echo "overall_time=$formatted_time" >> $GITHUB_ENV
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "pr_url=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "diff=${{ github.event.pull_request.html_url }}/commits/${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
echo "commit_message=$(git log --format=%s -n 1 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV
echo "commit=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
echo "author=$(git log --format='%an <%ae>' -n 1 ${{ github.sha }})" >> $GITHUB_ENV
echo "date=$(git show -s --format=%ci ${{ github.sha }} | xargs -I{} date -d {} +'%a %b %d %T %Y %z')" >> $GITHUB_ENV
echo "current_job_status=${{ job.status }}" >> $GITHUB_ENV
- name: Record job data for push event
if: ${{ github.event_name == 'push' }}
run: |
end_time=$(date +%s)
start_time=${{ steps.start.outputs.start_time }}
elapsed_time=$(($end_time-$start_time))
formatted_time=$(date -u -d @$elapsed_time +"%M:%S")
echo "overall_time=$formatted_time" >> $GITHUB_ENV
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
echo "diff=${{ github.event.compare }}" >> $GITHUB_ENV
echo "commit_message=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_ENV
echo "commit=${{ github.sha }}" >> $GITHUB_ENV
echo "author=${{ github.event.pusher.name }}" >> $GITHUB_ENV
echo "date=$(git show -s --format=%ci ${{ github.sha }} | xargs -I{} date -d {} +'%a %b %d %T %Y %z')" >> $GITHUB_ENV
echo "current_job_status=${{ job.status }}" >> $GITHUB_ENV
- name: Post to Slack about the result of the Pull Request
if: ( always() && github.event_name == 'pull_request' && !(github.event.action == 'closed' && github.event.pull_request.merged == true) )
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: "C05P40DCGAK"
payload-file-path: ".github/workflows/payloads/pr_payload.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_WORKABLE_APP_OAUTH_TOKEN }}
- name: Post to Slack about the result of the push
if: ( always() && github.event_name == 'push' && github.ref == 'refs/heads/main' )
id: slack
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: "C05P40DCGAK"
payload-file-path: ".github/workflows/payloads/push_payload.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_WORKABLE_APP_OAUTH_TOKEN }}