summaryrefslogtreecommitdiffstats
path: root/.github/workflows/checksums.yml
blob: 5f444b639b374e5995491fa49e29375e91a84619 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: FIPS Checksums
on: [pull_request_target]
jobs:
  apply-label:
    runs-on: ubuntu-latest
    steps:
      - name: install unifdef
        run: |
            sudo apt-get update
            sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install unifdef
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.base.sha }}
      - name: create build dirs
        run: |
          mkdir ./build-pristine
          mkdir ./build
      - name: config pristine
        run: ../config enable-fips && perl configdata.pm --dump
        working-directory: ./build-pristine
      - name: make build_generated pristine
        run: make -s build_generated
        working-directory: ./build-pristine
      - name: make fips-checksums pristine
        run: make fips-checksums
        working-directory: ./build-pristine
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          clean: false
      - name: config
        run: ../config enable-fips && perl configdata.pm --dump
        working-directory: ./build
      - name: make build_generated
        run: make -s build_generated
        working-directory: ./build
      - name: make fips-checksums
        run: make fips-checksums
        working-directory: ./build
      - name: update checksums pristine
        run: touch providers/fips.checksum.new && make update-fips-checksums
        working-directory: ./build-pristine
      - name: make diff-fips-checksums
        run: make diff-fips-checksums && echo "fips_unchanged=1" >> $GITHUB_ENV || echo "fips_changed=1" >> $GITHUB_ENV
        working-directory: ./build
      - name: set label
        if: ${{ env.fips_changed }}
        continue-on-error: true
        uses: actions/github-script@v4
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            github.issues.addLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: ['severity: fips change']
            })
      - name: remove label
        if: ${{ env.fips_unchanged }}
        continue-on-error: true
        uses: actions/github-script@v4
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            github.issues.removeLabel({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              name: 'severity: fips change'
            })