-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Github Action to generate index file
- Loading branch information
1 parent
eb1076e
commit dc2df03
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Generate Index | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: | ||
- "**" | ||
pull_request: | ||
types: [opened, reopened, synchronize, edited] | ||
|
||
jobs: | ||
build: | ||
name: "Generate index and readme" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{github.head_ref}} | ||
|
||
- name: Setup PHP Action | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
|
||
- name: Check committer | ||
id: check | ||
run: | | ||
COMMITTER=$(git log -1 --pretty=format:'%ae') | ||
echo "COMMITTER=$COMMITTER" >> $GITHUB_ENV | ||
- name: Run script | ||
run: php .github/workflows/scripts/generate_index.php | ||
if: env.COMMITTER != '[email protected]' | ||
|
||
- name: Commit and push if it changed | ||
run: | | ||
git diff | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git commit -am "Update index.json and README.md" || exit 0 | ||
git push |