Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / .github / workflows / update-terraform-providers.yml
blob5aa1693bc9b3b05251040e618c7c574aec50ab1b
1 name: "Update terraform-providers"
3 on:
4   #schedule:
5   #  - cron: "0 3 * * *"
6   workflow_dispatch:
8 permissions:
9   contents: read
11 jobs:
12   tf-providers:
13     permissions:
14       contents: write # for peter-evans/create-pull-request to create branch
15       pull-requests: write # for peter-evans/create-pull-request to create a PR
16     if: github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master
17     runs-on: ubuntu-latest
18     steps:
19       - uses: actions/checkout@v4
20       - uses: cachix/install-nix-action@v23
21         with:
22           nix_path: nixpkgs=channel:nixpkgs-unstable
23       - name: setup
24         id: setup
25         run: |
26           echo "title=terraform-providers: update $(date -u +"%Y-%m-%d")" >> $GITHUB_OUTPUT
27       - name: update terraform-providers
28         env:
29           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30         run: |
31           git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
32           git config user.name "github-actions[bot]"
33           echo | nix-shell \
34             maintainers/scripts/update.nix \
35             --argstr commit true \
36             --argstr keep-going true \
37             --argstr max-workers 2 \
38             --argstr path terraform-providers
39       - name: get failed updates
40         run: |
41           echo 'FAILED<<EOF' >> $GITHUB_ENV
42           git ls-files --others >> $GITHUB_ENV
43           echo 'EOF' >> $GITHUB_ENV
44       # cleanup logs of failed updates so they aren't included in the PR
45       - name: clean repo
46         run: |
47           git clean -f
48       - name: create PR
49         uses: peter-evans/create-pull-request@v5
50         with:
51           body: |
52             Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
54             https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}
56             These providers failed to update:
57             ```
58             ${{ env.FAILED }}
59             ```
61             Check that all providers build with:
62             ```
63             @ofborg build terraform.full
64             ```
65             If there is more than ten commits in the PR `ofborg` won't build it automatically and you will need to use the above command.
66           branch: terraform-providers-update
67           delete-branch: false
68           title: ${{ steps.setup.outputs.title }}
69           token: ${{ secrets.GITHUB_TOKEN }}