|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: {} |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - "**" |
| 8 | + |
| 9 | +jobs: |
| 10 | + update-nginx-datadog: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + permissions: |
| 13 | + actions: read # read secrets |
| 14 | + contents: write # Creates a branch |
| 15 | + pull-requests: write # Creates a PR |
| 16 | + env: |
| 17 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + repository: 'DataDog/appsec-event-rules' |
| 22 | + - name: Checkout nginx-datadog |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + repository: 'DataDog/nginx-datadog' |
| 26 | + path: 'nginx-datadog' |
| 27 | + - run: cp build/recommended.json nginx-datadog/src/security/recommended.json |
| 28 | + - name: Set git branch name |
| 29 | + run: | |
| 30 | + echo "branch_id=deps/appsec-rules-${GITHUB_SHA::7}" >> "$GITHUB_ENV" |
| 31 | + echo "tag_id=${GITHUB_REF##*/}" >> "$GITHUB_ENV" |
| 32 | + - name: Create Branch |
| 33 | + working-directory: nginx-datadog |
| 34 | + run: | |
| 35 | + git config --local user.name "github-actions[bot]" |
| 36 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 37 | + git remote set-url --push origin https://your_username:[email protected]/DataDog/nginx-datadog |
| 38 | + git checkout -b ${branch_id} |
| 39 | + git add src/security/recommended.json |
| 40 | + git commit -m "deps(appsec): bump rules to ${tag_id}" |
| 41 | + git push |
| 42 | + # - name: Create Pull Request |
| 43 | + # run: | |
| 44 | + # curl -L \ |
| 45 | + # -X POST \ |
| 46 | + # -H "Accept: application/vnd.github+json" \ |
| 47 | + # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 48 | + # -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 49 | + # https://api.github.com/repos/DataDog/nginx-datadog/pulls \ |
| 50 | + # -d '{"title":"deps: bump rules to ${tag_id}","body":"Updates appsec rules!","head":"${branch}","base":"master"}' |
0 commit comments