forked from cfengine/build-index
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.71 KB
/
mirroring.yml
File metadata and controls
81 lines (69 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Modules mirroring to S3
on:
push:
branches:
- master
paths:
- cfbs.json
workflow_dispatch:
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for cfengine/create-pull-request
pull-requests: write
jobs:
mirroring:
runs-on: ubuntu-latest
env:
AWS_REGION: us-east-1
AWS_ROLE: arn:aws:iam::304194462000:role/cfbs-github-action
AWS_ROLE_SESSION_NAME: cfbs-github-action
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: configure aws credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
role-to-assume: ${{ env.AWS_ROLE }}
role-session-name: ${{ env.AWS_ROLE_SESSION_NAME }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload modules to S3
run: node scripts/s3uploading.js
env:
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 "body=$body" >> $GITHUB_OUTPUT
- 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