Skip to content

Merge pull request #311 from SudoWeezy/main #1

Merge pull request #311 from SudoWeezy/main

Merge pull request #311 from SudoWeezy/main #1

name: Create Dev Portal Content
on:
push:
branches:
- main # Trigger on changes to the main branch
paths:
- "ARCs/**" # Only run when files in the ARCs directory are changed
jobs:
updateDevportal:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v2
# Step 2: Set execute permission for the scripts and create the content directory if needed
- name: Make scripts executable
run: |
chmod +x _devportal/scripts/update-arcs.sh
chmod +x _devportal/scripts/update-guideline.sh
chmod +x _devportal/scripts/update-index.sh
mkdir -p _devportal/content
# Step 3: Set up Git identity
- name: Set up Git user
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
# Step 4: Run update-arcs.sh script
- name: Run update-arcs.sh
run: _devportal/scripts/update-arcs.sh
# Step 5: Run update-guideline.sh script
- name: Run update-guideline.sh
run: _devportal/scripts/update-guideline.sh
# Step 6: Run update-index.sh script
- name: Run update-index.sh
run: _devportal/scripts/update-index.sh
# Step 7: Force changes to be recognized by Git
- name: Touch modified files
run: |
find _devportal/content -type f -exec touch {} \;
# Step 8: Commit and push changes if there are any
- name: Commit and push changes
run: |
git add -A # Ensure all changes are staged
git add -f _devportal/content/*
echo "Git status before commit:"
git status # Display git status for debugging
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Auto-update ARC content and headers"
BRANCH_NAME="devportal"
# Check if the branch exists in the remote
if git ls-remote --exit-code origin "$BRANCH_NAME"; then
echo "Branch $BRANCH_NAME exists."
else
echo "Branch $BRANCH_NAME does not exist. Creating it."
git checkout -b "$BRANCH_NAME"
fi
git push origin "$BRANCH_NAME"
else
echo "No changes to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}