4 task adr template #2
Workflow file for this run
This file contains 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: Restrict PR to Main Branch | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
restrict-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Verify source branch | |
run: | | |
echo "Pull Request from branch: ${{ github.head_ref }}" | |
echo "Target branch: ${{ github.base_ref }}" | |
if [ "${{ github.base_ref }}" != "main" ]; then | |
echo "Error: This workflow is configured to target the 'main' branch only." | |
exit 1 | |
fi | |
if [ "${{ github.head_ref }}" != "dev" ]; then | |
echo "Error: Only pull requests from 'dev' branch are allowed to be merged into 'main'." | |
exit 1 | |
fi | |
- name: PR Approved | |
run: echo "Pull Request validation passed. PR from 'dev' to 'main' is valid." |