Hello, this is an amazing title, Fixes AB#1234 #17
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
# This is a basic workflow to help you get started with Actions | |
name: "Commit Fix ADB#ID" | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
is_pr_comment_valid: | |
runs-on: ubuntu-latest | |
if: github.event.issue.pull_request && contains(github.event.comment.body, 'lcc-200') | |
steps: | |
- name: Check if comment with approval has been generated | |
run: | | |
echo "PR ready" | |
extract_ab: | |
needs: is_pr_comment_valid | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set enviroment variable with AB ID | |
run: | | |
result=$(echo "${{ github.event.comment.body }}" | grep -oP '(?<=#)\d+') | |
echo "ABID=${result}" >> $GITHUB_ENV | |
- name: Print result | |
run: | | |
echo "$ABID" | |
commit_and_push: | |
needs: extract_ab | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get PR branch | |
uses: xt0rted/pull-request-comment-branch@v1 | |
id: comment-branch | |
- name: Checkout PR branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
fetch-depth: 0 | |
- name: Commit tag | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit --allow-empty -m "Fixed AB#$ABID" | |
# This requires read and write Workflow permissions | |
# see: https://github.com/ad-m/github-push-action | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: ${{ steps.comment-branch.outputs.head_ref }} | |
update-pr-title: | |
needs: extract_ab | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update PR title | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { data: pullRequest } = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: github.event.issue.pull_request.number, | |
}); | |