-
Notifications
You must be signed in to change notification settings - Fork 32
55 lines (49 loc) · 2.16 KB
/
update-active-policy-list.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Update Active Policy List
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_run
# https://stackoverflow.com/questions/58457140/dependencies-between-workflows-on-github-actions
on:
# Trigger this workflow when "Test Policies" completes successfully. after running against the "master" branch
# This mitigates publishing broken policies
workflow_run:
workflows: ["Test Policies"]
branches: [master]
types:
- completed
# Workflow dispatch trigger allows manually running workflow
workflow_dispatch:
branches:
- master
jobs:
policy_list:
name: "Update Active Policy List"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
# ruby-version: 2.4.1 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Generate Active Policy List
shell: bash -l {0} # https://github.com/actions/virtual-environments/issues/4
run: |
bundle install --without documentation --path bundle
bundle exec rake generate_policy_list
cp dist/active-policy-list.json data/active_policy_list/active_policy_list.json
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: "Update active policy list"
title: "Update Active Policy List"
body: "Update Active Policy List from GitHub Actions Workflow [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
branch: "task/update-active-policy-list"
add-paths: "data/active_policy_list/active_policy_list.json"
delete-branch: true
labels: "automation, data"
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"