Trying to get this action to work although I either get an empty JSON or an error.
name: Pull Request Lint
on:
pull_request:
types: ['opened', 'edited', 'synchronize', 'reopened']
jobs:
pr_linter:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Lint branch name and PR title
uses: aschbacd/[email protected]
with:
commit-message-subject-max-length: 100
re-commit-message-subject: .*
re-branch-name: '^[0-9]{4}-'
re-pull-request-title: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)'
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
- name: Running on a pull request branch.
id: extract_branch
if: steps.branch-name.outputs.is_default == 'false'
run: |
echo "Running on pr: ${{ steps.branch-name.outputs.current_branch }}"
echo "branch_name=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_ENV
- name: step1
id: step1
run: echo 'step_1_json={"a":1}' >> $GITHUB_ENV
if: true
- name: step2
run: echo $A && echo $B && echo $C
env:
A: ${{ env.step_1_json && fromJSON(env.step_1_json).a }}
B: ${{ env.step_1_json }}
C: ${{ fromJSON(env.step_1_json).a }}
if: true
- uses: 8BitJonny/[email protected]
id: PR
with:
sha: ${{ github.event.pull_request.head.sha }}
- run: echo "PR ${prNumber} ${prTitle} at ${prUrl}"
if: steps.PR.outcome == 'success'
env:
# TODO: try and get JSON object with the full PR object working
# toJSON(fromJSON(...pr)) parses it into memory and then format is with pretty-print.
prJSON: ${{ toJSON(fromJSON(steps.current_pr.outputs.pr)) }}
# Direct access to common PR properties
prNumber: ${{ steps.PR.outputs.number }}
prUrl: ${{ steps.PR.outputs.pr_url }}
prTitle: ${{ steps.PR.outputs.pr_title }}
prBody: ${{ steps.PR.outputs.pr_body }}
prCreatedAt: ${{ steps.PR.outputs.pr_created_at }}
prMergedAt: ${{ steps.PR.outputs.pr_merged_at }}
prClosedAt: ${{ steps.PR.outputs.pr_closed_at }}
prLabel: ${{ steps.PR.outputs.pr_labels }}
- if: ${{ steps.PR.outputs.pr_body }} != 'Fixed AB#${{ env.branch_name }}'
uses: DerekRoberts/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# add_markdown: Fixed AB#${{ env.branch_name }}
I get an error and/or empty JSON returned.