mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Only allow staging to run off of the master branch
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
5dfc22c28b
commit
7b395348b3
2 changed files with 33 additions and 7 deletions
18
.github/workflows/staging.yml
vendored
18
.github/workflows/staging.yml
vendored
|
@ -26,8 +26,8 @@ concurrency:
|
|||
|
||||
jobs:
|
||||
|
||||
check-permissions:
|
||||
name: Check Permissions
|
||||
check-requirements:
|
||||
name: Check Requirements
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check For Admin Permission
|
||||
|
@ -36,11 +36,21 @@ jobs:
|
|||
require: admin
|
||||
username: ${{ github.triggering_actor }}
|
||||
|
||||
- name: Check Branch
|
||||
run: |
|
||||
echo "Trying to run the staging workflow from branch ${{ github.ref_name }}"
|
||||
if [ "${{ github.ref_name }}" != "master" ]; then
|
||||
echo "Running the staging workflow from the ${{ github.ref_name }} branch is not allowed"
|
||||
exit 1
|
||||
else
|
||||
echo "Allowed"
|
||||
fi
|
||||
|
||||
prepare-workflow:
|
||||
name: Prepare Workflow Run
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check-permissions
|
||||
- check-requirements
|
||||
outputs:
|
||||
jobs: ${{ steps.define-jobs.outputs.jobs }}
|
||||
runners: ${{ steps.runner-types.outputs.runners }}
|
||||
|
@ -873,7 +883,7 @@ jobs:
|
|||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check-permissions
|
||||
- check-requirements
|
||||
- prepare-workflow
|
||||
- pre-commit
|
||||
- lint
|
||||
|
|
22
.github/workflows/templates/staging.yml.jinja
vendored
22
.github/workflows/templates/staging.yml.jinja
vendored
|
@ -26,10 +26,11 @@ concurrency:
|
|||
|
||||
<%- block pre_jobs %>
|
||||
|
||||
<%- do prepare_workflow_needs.append('check-permissions') %>
|
||||
<%- set job_name = "check-requirements" %>
|
||||
|
||||
check-permissions:
|
||||
name: Check Permissions
|
||||
<{ job_name }>:
|
||||
<%- do prepare_workflow_needs.append(job_name) %>
|
||||
name: Check Requirements
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check For Admin Permission
|
||||
|
@ -37,6 +38,21 @@ concurrency:
|
|||
with:
|
||||
require: admin
|
||||
username: ${{ github.triggering_actor }}
|
||||
|
||||
- name: Check Branch
|
||||
run: |
|
||||
|
||||
{#-
|
||||
Should we allow other branches?
|
||||
#}
|
||||
echo "Trying to run the staging workflow from branch ${{ github.ref_name }}"
|
||||
if [ "${{ github.ref_name }}" != "master" ]; then
|
||||
echo "Running the staging workflow from the ${{ github.ref_name }} branch is not allowed"
|
||||
exit 1
|
||||
else
|
||||
echo "Allowed"
|
||||
fi
|
||||
|
||||
<%- endblock pre_jobs %>
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue