Merge pull request #312711 from eliandoran/darwin/sdk_11
[NixPkgs.git] / .github / workflows / update-terraform-providers.yml
bloba1c949ba37709ffa98cbf24c02624821f86f5819
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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
20       - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
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@9153d834b60caba6d51c9b9510b087acf9f33f83 # v6.0.4
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 opentofu.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 }}