Update server agent file #3
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: Update server agent file | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- config/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
update-server-agent-file: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- run: npm ci | |
- name: Run command | |
run: ./bin/dev monitors | |
- name: Test repo | |
id: repo | |
shell: bash | |
run: | | |
if [[ $(git diff --stat) != '' ]]; then | |
echo 'Repo dirty' | |
echo "test=dirty" >> "$GITHUB_OUTPUT" | |
else | |
echo 'Skipping commit' | |
echo "test=clean" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Commit project files | |
if: steps.repo.outputs.test == 'dirty' | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add monitor/fluentbit-agents.csv | |
git add monitor/monitors.json | |
git commit -m "Update fluentbit agent and monitor file" | |
- name: Push changes | |
if: steps.repo.outputs.test == 'dirty' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |