Do not hardcode repository name #2
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
name: Alphabetise extension list | ||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- antora-playbook.yml | ||
workflow_dispatch: | ||
defaults: | ||
run: | ||
shell: bash | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- name: Install packages | ||
run: npm install -g yaml-sort | ||
- name: Alphabetise | ||
id: alpha | ||
uses: mikefarah/yq@master | ||
with: | ||
path: antora-playbook.yml | ||
cmd: '.content.sources |= sort_by(.url)' | ||
- name: Overwite file | ||
run: | | ||
echo ${{ steps.alpha.outputs.result }} > antora-playbook.yml | ||
- name: Create Pull Request | ||
run: | | ||
git checkout -b alpha-${{ github.run_id }} | ||
git add antora-playbook.yml | ||
git commit -m "Automatic alphabetisation" | ||
git push | ||
gh pr create --title "Automatic alphabetisation" --fill --repo $GITHUB_REPOSITORY | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||