Skip to content

Test ARC jobs

Test ARC jobs #106

Workflow file for this run

name: Generate action documentation
on:
push:
branches: [trunk]
jobs:
build_docs_image:
name: Build image for gh-actions-docs
runs-on: ubuntu-latest
env:
IMAGE_NAME: 'ghcr.io/3lvia/core-github-actions-templates/gh-actions-docs:latest'
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: 'ghcr.io'
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v5
with:
context: '.github/gh-actions-docs'
push: true
tags: '${{ env.IMAGE_NAME }}'
cache-from: 'type=registry,ref=${{ env.IMAGE_NAME }}'
cache-to: 'type=inline'
generate_docs:
name: Generate action documentation
runs-on: ubuntu-latest
needs: [build_docs_image]
outputs:
readme: ${{ steps.set-output.outputs.readme }}
container:
image: ghcr.io/3lvia/core-github-actions-templates/gh-actions-docs:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate action documentation
run: gh-actions-docs
env:
IGNORE_FILES: 'my-new-action/action.yml'
IGNORE_HEADERS: '# core-github-actions-templates,## Table of Contents'
- name: Set output
id: set-output
run: |
{
echo 'readme<<EOF'
cat README.md | base64
echo EOF
} >> "$GITHUB_OUTPUT"
commit_docs:
name: Commit action documentation
runs-on: ubuntu-latest
needs: [generate_docs]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache dependencies
uses: actions/cache@v4
with:
path: '**/node_modules'
key: "${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Get README from output
run: echo '${{ needs.generate_docs.outputs.readme }}' | base64 -d > README.md
- name: Format README
run: yarn prettier -w --single-quote README.md
- name: Commit changes
run: |
if [[ -z "$(git status --porcelain)" ]]; then
echo "No changes to commit."
exit 0
fi
git config user.name github-actions
git config user.email [email protected]
git add README.md
git commit -m "Update action documentation"
git push