2022-01-07 04:07:37 +00:00
name : "Update terraform-providers"
on :
2023-10-09 19:29:22 +00:00
#schedule:
# - cron: "0 3 * * *"
2022-01-07 04:07:37 +00:00
workflow_dispatch :
2022-07-14 12:49:19 +00:00
permissions :
contents : read
2022-01-07 04:07:37 +00:00
jobs :
tf-providers :
2022-07-14 12:49:19 +00:00
permissions :
2023-01-11 07:51:40 +00:00
contents : write # for peter-evans/create-pull-request to create branch
2023-03-27 19:17:25 +00:00
pull-requests : write # for peter-evans/create-pull-request to create a PR
2022-01-07 04:07:37 +00:00
if : github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master
runs-on : ubuntu-latest
steps :
2024-01-02 11:29:13 +00:00
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2024-01-25 14:12:00 +00:00
- uses : cachix/install-nix-action@6004951b182f8860210c8d6f0d808ec5b1a33d28 # v25
2022-09-22 12:36:57 +00:00
with :
nix_path : nixpkgs=channel:nixpkgs-unstable
2022-01-07 04:07:37 +00:00
- name : setup
id : setup
run : |
2022-10-21 18:38:19 +00:00
echo "title=terraform-providers: update $(date -u +"%Y-%m-%d")" >> $GITHUB_OUTPUT
2022-01-07 04:07:37 +00:00
- name : update terraform-providers
2023-01-11 07:51:40 +00:00
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2022-01-07 04:07:37 +00:00
run : |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
2022-10-21 18:38:19 +00:00
echo | nix-shell \
maintainers/scripts/update.nix \
--argstr commit true \
--argstr keep-going true \
--argstr max-workers 2 \
--argstr path terraform-providers
2023-03-27 19:17:25 +00:00
- name : get failed updates
run : |
echo 'FAILED<<EOF' >> $GITHUB_ENV
git ls-files --others >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# cleanup logs of failed updates so they aren't included in the PR
2022-10-21 18:38:19 +00:00
- name : clean repo
run : |
git clean -f
2022-01-07 04:07:37 +00:00
- name : create PR
2024-01-02 11:29:13 +00:00
uses : peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
2022-01-07 04:07:37 +00:00
with :
body : |
2022-04-27 09:35:20 +00:00
Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
2022-01-07 04:07:37 +00:00
2022-10-21 18:38:19 +00:00
https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}
2023-03-27 19:17:25 +00:00
These providers failed to update :
```
${{ env.FAILED }}
```
2022-04-27 09:35:20 +00:00
Check that all providers build with :
```
2024-01-02 11:29:13 +00:00
@ofborg build opentofu.full
2022-04-27 09:35:20 +00:00
```
2023-03-27 19:17:25 +00:00
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.
2022-01-07 04:07:37 +00:00
branch : terraform-providers-update
delete-branch : false
title : ${{ steps.setup.outputs.title }}
token : ${{ secrets.GITHUB_TOKEN }}