Skip to content

Merge pull request #412 from es-na-battlesnake/combine-prs-branch #817

Merge pull request #412 from es-na-battlesnake/combine-prs-branch

Merge pull request #412 from es-na-battlesnake/combine-prs-branch #817

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Deploy Safety
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
outputs:
result: ${{ steps.safe-deploy.outputs.result }}
permissions:
pull-requests: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38.2.0
- name: Warn if deployment workflow changes
id: safe-deploy
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
# If .github/workflows/docker-image.yml workflow was changed, warn.
if [[ "$file" == ".github/workflows/docker-image.yml" ]]; then
echo "::set-output name=result::Your PR modifies <code>$file</code> which will trigger a full delete and redeploy on merge. Do not merge during the spring league game window starting 1:00 am ET / 10:00 pm PT and the following 8 hours. See issue #100"
fi
done
# Use the output from the `safe-deploy step
- name: Get the safe-deploy output
run: echo "${{ steps.safe-deploy.outputs.result }}"
- name: Post comment
uses: mshick/add-pr-comment@v2
if: ${{ steps.safe-deploy.outputs.result }}
with:
message: |
:warning: Hello snake charmer! Please tread carefully:
${{ steps.safe-deploy.outputs.result }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
allow-repeats: false # This is the default