dag-updated #33
This file contains hidden or 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: 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 | |
| - 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 |