-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) · 1.21 KB
/
Copy pathpull_from_s3.yml
File metadata and controls
45 lines (37 loc) · 1.21 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
name: Sync DAGs from S3 and Push
on:
repository_dispatch:
types: [dag-updated]
workflow_dispatch:
permissions:
id-token: write
contents: write
jobs:
sync-dags:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.CDR_PUSH_PAT }}
fetch-depth: 1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-ecr-role
aws-region: eu-central-1
audience: sts.amazonaws.com
- name: Download DAGs from S3
run: aws s3 sync s3://airflow-dags-bc/ dags/ --exact-timestamps --delete
- name: Commit and push DAG changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add dags/
if ! git diff --cached --quiet; then
git commit -m "sync DAGs from S3"
git push origin HEAD:main
echo "Changes pushed successfully."
else
echo "No DAG changes to commit."
fi