generate #698
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
# This is a hack to update the fleet_{input,integration}/* modules daily. | |
# One issue is that there may be unreleased changes in that repo. | |
name: generate | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
integrations: | |
permissions: | |
# Allow job to write to the branch. | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.x' | |
cache-dependency-path: tools/go.sum | |
- uses: actions/checkout@v4 | |
with: | |
repository: elastic/integrations | |
path: integrations | |
- name: move integrations dir | |
run: mv integrations ../ | |
- name: integration commit | |
id: integrations | |
working-directory: ../integrations | |
run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: update modules | |
run: make modules | |
- name: check for modified modules | |
id: is-changed | |
run: echo "modified=$(if git status --porcelain --untracked-files=no | grep -q -E 'module.tf.json$|README.md$'; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT | |
- name: commit updated modules | |
if: github.event_name != 'pull_request' && steps.is-changed.outputs.modified == 'true' | |
env: | |
INTEGRATIONS_COMMIT: ${{ steps.integrations.outputs.commit }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add -u ./fleet_integration ./fleet_input | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git commit -m "Update to elastic/integrations@${INTEGRATIONS_COMMIT} | |
Update modules based on https://github.com/elastic/integrations/commit/${INTEGRATIONS_COMMIT}" | |
git push |