|
| 1 | +name: 'Create Pull Request' |
| 2 | +description: 'Create a pull request from a feature branch to master' |
| 3 | +inputs: |
| 4 | + pat: |
| 5 | + description: 'GitHub PAT' |
| 6 | + required: true |
| 7 | + slack-web-hook: |
| 8 | + description: 'Slack WebHook URL' |
| 9 | + required: true |
| 10 | + slack-channel-name: |
| 11 | + description: 'Slack channel name' |
| 12 | + required: true |
| 13 | + |
| 14 | +runs: |
| 15 | + using: 'composite' |
| 16 | + steps: |
| 17 | + - name: Get branch name |
| 18 | + id: branch-name |
| 19 | + uses: tj-actions/branch-names@v6 |
| 20 | + |
| 21 | + - name: Create Pull Request |
| 22 | + uses: devops-infra/action-pull-request@v0.5.0 |
| 23 | + with: |
| 24 | + github_token: ${{ inputs.pat }} |
| 25 | + source_branch: '${{ steps.branch-name.outputs.current_branch }}' |
| 26 | + target_branch: master |
| 27 | + title: 'Merge ${{ steps.branch-name.outputs.current_branch }} to master' |
| 28 | + body: '**Automated pull request**' |
| 29 | + assignee: ${{ github.actor }} |
| 30 | + draft: false |
| 31 | + allow_no_diff: false |
| 32 | + get_diff: true |
| 33 | + |
| 34 | + - name: Notify Slack on Success |
| 35 | + if: ${{ success() }} |
| 36 | + uses: ./.github/actions/slack-notifier |
| 37 | + with: |
| 38 | + action-status: ${{ job.status }} |
| 39 | + slack-web-hook: ${{ inputs.slack-web-hook }} |
| 40 | + slack-channel-name: ${{ inputs.slack-channel-name }} |
| 41 | + title: 'Create PR Success :pass:' |
| 42 | + message: 'Create PR on ${{ inputs.branch-name }} succeeded :pass: :fireparrot: :sheepy:' |
| 43 | + |
| 44 | + - name: Notify Slack on Failure |
| 45 | + if: ${{ failure() }} |
| 46 | + uses: ./.github/actions/slack-notifier |
| 47 | + with: |
| 48 | + action-status: ${{ job.status }} |
| 49 | + slack-web-hook: ${{ inputs.slack-web-hook }} |
| 50 | + slack-channel-name: ${{ inputs.slack-channel-name }} |
| 51 | + title: 'Create PR Failed :fail:' |
| 52 | + message: 'Create PR on ${{ inputs.branch-name }} failed :fail: :terror: :alert:' |
0 commit comments