merge: develop to main #14
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: "Enforce Branch PR's from Develop" | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- edited | |
- synchronize | |
- reopened | |
jobs: | |
check-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }} | |
private-key: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY }} | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
id: import_gpg | |
with: | |
gpg_private_key: ${{ secrets.LERIAN_CI_CD_USER_GPG_KEY }} | |
passphrase: ${{ secrets.LERIAN_CI_CD_USER_GPG_KEY_PASSWORD }} | |
git_committer_name: ${{ secrets.LERIAN_CI_CD_USER_NAME }} | |
git_committer_email: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Check if PR is from develop or hotfix | |
if: github.event.pull_request.head.ref != 'develop' && github.event.pull_request.head.ref != 'hotfix' | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
GIT_AUTHOR_NAME: ${{ secrets.LERIAN_CI_CD_USER_NAME }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }} | |
GIT_COMMITTER_NAME: ${{ secrets.LERIAN_CI_CD_USER_NAME }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.LERIAN_CI_CD_USER_EMAIL }} | |
run: | | |
echo "Pull requests to main can only come from develop or hotfix branches." | |
# Add a request for changes comment on the pull request | |
curl -s -X POST \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
-d '{"body": "Pull requests to **main** can only come from **develop** or **hotfix** branches. Please **change base**!!!", "event": "REQUEST_CHANGES"}' \ | |
"${{ github.event.pull_request.url }}/reviews" |