Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GHA updater for keep sample data at a reasonable date #11593

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/update-sample-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update Sample Data

env:
GIT_USERNAME: "DefectDojo release bot"
GIT_EMAIL: "[email protected]"

on:
workflow_dispatch: # Trigger manually
schedule:
# Run on the 1st day of January, April, July, and October at midnight UTC
- cron: '0 0 1 1,4,7,10 *'

jobs:
run-binary-and-create-pr:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref_name || 'dev'}}

- name: Run binary
run: |
./fixture-updater dojo/fixtures/defect_dojo_sample_data.json
mv output.json dojo/fixtures/defect_dojo_sample_data.json

- name: Configure git
run: |
git config --global user.name "${{ env.GIT_USERNAME }}"
git config --global user.email "${{ env.GIT_EMAIL }}"

- name: Create and switch to a new branch
run: |
git checkout -b update-file-$(date +%Y%m%d%H%M%S)
git add dojo/fixtures/defect_dojo_sample_data.json
git commit -m "Update sample data"

- name: Push branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update sample data"
branch: ${{ github.ref_name || 'dev'}}
base: dev
title: "Update sample data"
body: "This pull request updates the sample data."
Loading
Loading