2022-01-04 01:57:23 +01:00
name : "Update terraform-providers"
on :
2023-08-31 13:35:48 +02:00
#schedule:
# - cron: "0 3 * * *"
2023-09-01 04:29:15 +02:00
workflow_dispatch :
2022-01-04 01:57:23 +01:00
2022-07-04 03:09:50 +02:00
permissions :
contents : read
2022-01-04 01:57:23 +01:00
jobs :
tf-providers :
2022-07-04 03:09:50 +02:00
permissions :
2023-01-02 04:48:28 +01:00
contents : write # for peter-evans/create-pull-request to create branch
2023-03-24 00:50:30 +01:00
pull-requests : write # for peter-evans/create-pull-request to create a PR
2022-01-04 01:57:23 +01:00
if : github.repository_owner == 'NixOS' && github.ref == 'refs/heads/master' # ensure workflow_dispatch only runs on master
runs-on : ubuntu-latest
steps :
2023-09-11 13:53:12 +02:00
- uses : actions/checkout@v4
2023-09-05 16:26:48 +02:00
- uses : cachix/install-nix-action@v23
2022-09-21 04:13:25 +02:00
with :
nix_path : nixpkgs=channel:nixpkgs-unstable
2022-01-04 01:57:23 +01:00
- name : setup
id : setup
run : |
2022-10-15 23:39:03 +02:00
echo "title=terraform-providers: update $(date -u +"%Y-%m-%d")" >> $GITHUB_OUTPUT
2022-01-04 01:57:23 +01:00
- name : update terraform-providers
2023-01-02 04:48:28 +01:00
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2022-01-04 01:57:23 +01:00
run : |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
2022-10-07 11:38:55 +02:00
echo | nix-shell \
2022-10-04 00:10:28 +02:00
maintainers/scripts/update.nix \
--argstr commit true \
--argstr keep-going true \
2022-10-07 13:44:11 +02:00
--argstr max-workers 2 \
2022-10-04 00:10:28 +02:00
--argstr path terraform-providers
2023-03-24 00:50:30 +01: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-14 07:51:43 +02:00
- name : clean repo
run : |
2022-10-07 13:44:11 +02:00
git clean -f
2022-01-04 01:57:23 +01:00
- name : create PR
2023-04-10 14:00:08 +02:00
uses : peter-evans/create-pull-request@v5
2022-01-04 01:57:23 +01:00
with :
body : |
2022-04-28 00:13:20 +02:00
Automatic update by [update-terraform-providers](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/update-terraform-providers.yml) action.
2022-01-04 01:57:23 +01:00
2022-10-14 07:51:43 +02:00
https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}
2023-03-24 00:50:30 +01:00
These providers failed to update :
```
${{ env.FAILED }}
```
2022-04-28 00:13:20 +02:00
Check that all providers build with :
```
2022-08-02 19:45:05 +02:00
@ofborg build terraform.full
2022-04-28 00:13:20 +02:00
```
2023-03-24 00:50:30 +01: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-04 01:57:23 +01:00
branch : terraform-providers-update
delete-branch : false
title : ${{ steps.setup.outputs.title }}
token : ${{ secrets.GITHUB_TOKEN }}