Skip to content

feat(gha): Pin and update actions/checkout #1

feat(gha): Pin and update actions/checkout

feat(gha): Pin and update actions/checkout #1

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@@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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."