Skip to content

Fix order

Fix order #734

name: Parse Submission
on:
push:
branches:
- main
jobs:
check-commit-message:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.RBD_GITHUB_TOKEN }}
- name: Check commit message
id: check
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
if [[ "$COMMIT_MESSAGE" == "Update repository stats" || "$COMMIT_MESSAGE" == "Update app info" ]]; then
echo "skip=true" >> $GITHUB_ENV
echo "::set-output name=skip::true"
else
echo "skip=false" >> $GITHUB_ENV
echo "::set-output name=skip::false"
fi
update-app-info:
if: needs.check-commit-message.outputs.skip == 'false'
runs-on: ubuntu-latest
needs: check-commit-message
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.RBD_GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: cd shipixen && npm install
- name: Run update script
run: cd shipixen/scripts && node parse-app-info.js
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Update app info"
git pull --rebase
git push
env:
GITHUB_TOKEN: ${{ secrets.RBD_GITHUB_TOKEN }}
update-stats:
if: needs.check-commit-message.outputs.skip == 'false'
runs-on: ubuntu-latest
needs: update-app-info
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
token: ${{ secrets.RBD_GITHUB_TOKEN }}
- name: Get repository stats
id: get_stats
run: |
REPO_INFO=$(curl -s https://api.github.com/repos/${{ github.repository }})
STARS=$(echo $REPO_INFO | jq .stargazers_count)
FORKS=$(echo $REPO_INFO | jq .forks_count)
echo "stars=$STARS" >> $GITHUB_ENV
echo "forks=$FORKS" >> $GITHUB_ENV
- name: Write stats to stats.js
run: |
echo "module.exports = { stars: ${{ env.stars }}, forks: ${{ env.forks }} };" > shipixen/data/stats.js
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.RBD_GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add shipixen/data/stats.js
git commit -m 'Update repository stats'
git pull --rebase
git push https://x-access-token:${{ secrets.RBD_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git