Merge pull request #542 from nickanderson/lynis-3.1.2/master #249
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: Modules mirroring to S3 | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- cfbs.json | |
workflow_dispatch: | |
jobs: | |
mirroring: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checks-out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2.4.1 | |
- name: Install node dependencies | |
run: | | |
cd scripts | |
npm install | |
- name: Upload modules to S3 | |
run: node scripts/s3uploading.js | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
BUCKET_NAME: cfbs | |
workdir: ${{ github.workspace }} | |
- name: Check if there are changes | |
run: | | |
git diff --exit-code || touch git_diff_exists | |
if [ -f git_diff_exists ]; then echo "Changes need to be commited"; else echo "No changes to commit"; fi | |
- name: Commit version.json | |
if: hashFiles('git_diff_exists') != '' | |
run: | | |
git config user.name 'GitHub' | |
git config user.email '<noreply@github.com>' | |
git add versions.json | |
git commit -F commitMsg.txt || echo "versions.json is not changed" | |
- id: commit-message-from-file | |
name: Parse commit message from file into variable | |
if: hashFiles('git_diff_exists') != '' | |
run: | | |
body=$(cat commitMsg.txt) | |
body="${body//$'\n'/'%0A'}" | |
echo ::set-output name=body::$body | |
- name: Create Pull Request | |
if: hashFiles('git_diff_exists') != '' | |
uses: cfengine/create-pull-request@v7 | |
with: | |
title: versions.json changes by mirroring action | |
body: ${{ steps.commit-message-from-file.outputs.body }} | |
reviewers: | | |
olehermanse | |
nickanderson | |
branch: mirroring/path |