Skip to content

Example: CMS Astro

Example: CMS Astro #54

name: Fix License Headers
on:
pull_request_target:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
header-license-fix:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Fix License Header
# pin to include https://github.com/apache/skywalking-eyes/pull/168
uses: apache/skywalking-eyes/header@e19b828cea6a6027cceae78f05d81317347d21be
with:
mode: fix
- name: List files changed
id: files-changed
shell: bash -l {0}
run: |
set -ex
export CHANGES=$(git status --porcelain | tee /tmp/modified.log | wc -l)
cat /tmp/modified.log
echo "N_CHANGES=${CHANGES}" >> $GITHUB_OUTPUT
git diff
- name: Commit any changes
if: steps.files-changed.outputs.N_CHANGES != '0'
shell: bash -l {0}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git pull --no-tags
git add -A
git commit -m "Automatic application of license header"
git config push.default upstream
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}