Issue #14930: fixed inconsistent spacing between checks in google sty… #411
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
##################################################################################### | |
# GitHub Action to check references to closed issues in code. | |
# | |
# Workflow starts when: | |
# 1) push on master branch | |
# 2) pull request is opened or synchronized or reopened | |
# | |
##################################################################################### | |
name: "Check no closed issue references" | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: '*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check_issues: | |
if: github.repository == 'checkstyle/checkstyle' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download checkstyle | |
uses: actions/checkout@v4 | |
- name: PR linked issues | |
id: links | |
uses: mondeja/pr-linked-issues-action@v2 | |
if: github.event_name == 'pull_request' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
####################################################################### | |
# Linked issues, if present, are received in the following format: | |
# 37,38 | |
# We convert it into: | |
# https://github.com/checkstyle/checkstyle/issues/37 | |
# https://github.com/checkstyle/checkstyle/issues/38 | |
####################################################################### | |
- name: Format linked issues | |
id: format-linked-issues | |
if: github.event_name == 'pull_request' | |
run: | | |
LINKED_ISSUES=${{ steps.links.outputs.issues }} | |
LINKED_ISSUES_FORMATTED=/tmp/linked_issues | |
CHECKSTYLE_ISSUE_URL="https:\/\/github.com\/checkstyle\/checkstyle\/issues\/" | |
if [ -n "$LINKED_ISSUES" ]; then | |
# shellcheck disable=SC2001 | |
echo $LINKED_ISSUES | sed -e 's/,/\n/g' >> $LINKED_ISSUES_FORMATTED | |
sed -i "s/^/$CHECKSTYLE_ISSUE_URL/" $LINKED_ISSUES_FORMATTED | |
fi | |
echo "linked-issues-formatted=$LINKED_ISSUES_FORMATTED" >> "$GITHUB_OUTPUT" | |
- name: Check Issues | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
LINKED_ISSUES: '${{ steps.format-linked-issues.outputs.linked-issues-formatted }}' | |
PR_HEAD_REPO_NAME: "${{ github.event.pull_request.head.repo.full_name }}" | |
GITHUB_HEAD_REF: "${{ github.head_ref }}" | |
run: | | |
./.ci/no-old-refs.sh |